a - b: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Removed one bracket ]) |
||
Line 69: | Line 69: | ||
You have to cover it in extra brackets, because you want to remove the whole element. | You have to cover it in extra brackets, because you want to remove the whole element. | ||
Not: <code>[[3,3,3],[1,1,1],[5,5,5]] - [1,1,1] //Return: [[3,3,3],[1,1,1],[5,5,5]]</code> | Not: <code>[[3,3,3],[1,1,1],[5,5,5]] - [1,1,1] //Return: [[3,3,3],[1,1,1],[5,5,5]]</code> | ||
But this would work again: <code>[[3,3,3],-1,-1,-1 | But this would work again: <code>[[3,3,3],-1,-1,-1,[5,5,5]] - [1,1,1] //Return: [[3,3,3],[5,5,5]]</code> | ||
Note, that all elements found will be removed: <code>[1,2,3,2,4,3,5,2,6,2,7,2] - [2] //Return: [1,3,4,5,6,7]</code>}} | Note, that all elements found will be removed: <code>[1,2,3,2,4,3,5,2,6,2,7,2] - [2] //Return: [1,3,4,5,6,7]</code>}} |
Revision as of 20:05, 15 August 2016
Description
- Description:
- For numbers: a minus b.
- Groups:
- Uncategorised
Syntax
Examples
- Example 1:
Number
Result: _sum is 3
_sum = 10 - 7- Example 2:
For arrays: Contents of array b removed from array a.
_result is [1]
Array
_result = [1,2,2,player,"String"] - [2,player,player,"String"]
Additional Information
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Notes
-
Note that this way of removing elements from an array will not work if those elements are themselves arrays.
Example:
[[0,0,0],[1,1,1],[2,2,2] ] - [1,1,1]
Will not remove the element [1,1,1] from the first array.
A more practical example:
[ getPos unit1, getPos unit2, getPos unit3] - getPos unit3
Will not remove the position of unit3 from the first array.
Bottom Section
{{subst:Add new note/construct|This will work if you do: [[3,3,3],[1,1,1],[5,5,5]] - [[1,1,1] ] //Return: [[3,3,3],[5,5,5]]
You have to cover it in extra brackets, because you want to remove the whole element.
Not: [[3,3,3],[1,1,1],[5,5,5]] - [1,1,1] //Return: [[3,3,3],[1,1,1],[5,5,5]]
But this would work again: [[3,3,3],-1,-1,-1,[5,5,5]] - [1,1,1] //Return: [[3,3,3],[5,5,5]]
Note, that all elements found will be removed: [1,2,3,2,4,3,5,2,6,2,7,2] - [2] //Return: [1,3,4,5,6,7]
}}
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint version 1.00
- Operation Flashpoint: New Scripting Commands
- Operation Flashpoint: Scripting Commands
- Command Group: Uncategorised
- Scripting Commands OFP 1.99
- Scripting Commands OFP 1.96
- Scripting Commands OFP 1.46
- Scripting Commands ArmA
- Scripting Commands ArmA2
- Scripting Commands Arma 3
- Command Group: Math
- Command Group: Variables
- Notes: Improper Formatting