a - b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(#REDIRECT -)
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
#REDIRECT [[-]]
____________________________________________________________________________________________
 
| ofp |= Game name
 
|1.00|= Game version
____________________________________________________________________________________________
 
| For numbers: '''a''' minus '''b'''.  |= Description
____________________________________________________________________________________________
 
| a '''-''' b |= Syntax
 
 
|p1 = a: [[Number]] or [[Array]]
 
|p2 = b: [[Number]] or [[Array]]
 
| [[Number]] or [[Array]]  |= Return value
____________________________________________________________________________________________
|x1 = <code>[[Number]]<br>_sum <nowiki>=</nowiki> 10 '''-''' 7 </code>
Result: _sum is 3
 
|x2 = <code> For arrays: Contents of array '''b''' removed from array '''a'''.<br>[[Array]]<br>_result <nowiki>=</nowiki> [1,2,2,[[player]],"String"] '''-''' [2,[[player]],[[player]],"String"] </code>
_result is [1]
| [[Array]], [[Operators]] |= See also
 
}}
 
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
 
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.
 
 
<!-- Note Section END -->
</dl>
 
<h3 style="display:none">Bottom Section</h3>
 
 
 
 
 
[[Category:Scripting Commands|#]]
[[Category:Scripting Commands OFP 1.99|#]]
[[Category:Scripting Commands OFP 1.96|#]]
[[Category:Scripting Commands OFP 1.46|#]]
[[Category:Scripting Commands ArmA|#]]
[[Category:Scripting Commands ArmA2|#]]
[[Category:Scripting Commands Arma 3|#]]
[[Category:Command_Group:_Math|#]]
[[Category:Command_Group:_Variables|#]]
[[Category:Notes: Improper Formatting|{{uc:{{PAGENAME}}}}]]
 
 
This will work if you do: <code>[[3,3,3],[1,1,1],[5,5,5]] - [[1,1,1] ]</code>
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]</code>
But this would work again: <code>[[3,3,3],-1,-1,-1],[5,5,5]] - [1,1,1]</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>

Latest revision as of 00:26, 7 February 2019

Redirect to: