BIS fnc variableSpaceAdd: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "= <code>([^<]*)\[\[([a-zA-Z][a-zA-Z0-_]+)\]\]([^<]*)<\/code>" to "= <code>$1$2$3</code>")
m (Some wiki formatting)
 
(One intermediate revision by the same user not shown)
Line 19: Line 19:
|s1= [object, varName, element, global, inArray] call [[BIS_fnc_variableSpaceAdd]]
|s1= [object, varName, element, global, inArray] call [[BIS_fnc_variableSpaceAdd]]


|p1= object: [[Object]] - Owner of variable space
|p1= object: [[Object]] - owner of variable space


|p2= varName: [[String]] - Name of variable
|p2= varName: [[String]] - name of variable


|p3= element: [[Anything]] - Element which will be added (must be of same type as variable)
|p3= element: [[Anything]] - element which will be added (must be of same type as variable)


|p4= global: [[Boolean]] - (Optional, default [[false]]) [[true]] to save modified variable globally]]
|p4= global: [[Boolean]] - (Optional, default [[false]]) [[true]] to save modified variable globally


|p5= inArray: [[Boolean]] - (Optional, default [[false]]) [[true]] to check if element is already in variable (only for [[Array|arrays]])
|p5= inArray: [[Boolean]] - (Optional, default [[false]]) [[true]] to check if element is already in variable (only for [[Array]]s)


|r1= [[Anything]] - Updated variable
|r1= [[Anything]] - updated variable


|x1= <code>[player, "someVar", 1337, true, true] call BIS_fnc_variableSpaceAdd;</code>
|x1= <sqf>[player, "someVar", 1337, true, true] call BIS_fnc_variableSpaceAdd;</sqf>


|seealso= [[BIS_fnc_variableSpaceRemove]]
|seealso= [[BIS_fnc_variableSpaceRemove]]
}}
}}

Latest revision as of 13:01, 15 January 2023

Hover & click on the images for description

Description

Description:
Add element to variable from someone's variable space.
Execution:
call
Groups:
Variables

Syntax

Syntax:
[object, varName, element, global, inArray] call BIS_fnc_variableSpaceAdd
Parameters:
object: Object - owner of variable space
varName: String - name of variable
element: Anything - element which will be added (must be of same type as variable)
global: Boolean - (Optional, default false) true to save modified variable globally
inArray: Boolean - (Optional, default false) true to check if element is already in variable (only for Arrays)
Return Value:
Anything - updated variable

Examples

Example 1:
[player, "someVar", 1337, true, true] call BIS_fnc_variableSpaceAdd;

Additional Information

See also:
BIS_fnc_variableSpaceRemove

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