set: Difference between revisions
Jump to navigation
Jump to search
m (command group) |
Lou Montana (talk | contribs) m (Text replacement - " *\| *PARAMETER[0-9]{1,3} *= * " to " ") |
||
Line 23: | Line 23: | ||
| s2= hashMap '''set''' [key, value] | | s2= hashMap '''set''' [key, value] | ||
|p21= hashMap : [[HashMap]] | |p21= hashMap : [[HashMap]] | ||
|p22= key: [[HashMapKey]] | |p22= key: [[HashMapKey]] | ||
|p23= value: [[Anything]] | |p23= value: [[Anything]] | ||
|r2= [[Boolean]] - [[false]] if the key is new to the hashmap, [[true]] if a value got overwritten | |r2= [[Boolean]] - [[false]] if the key is new to the hashmap, [[true]] if a value got overwritten |
Revision as of 18:16, 29 January 2021
Description
- Description:
- Description needed
- Groups:
- ArraysHashMap
Syntax
- Syntax:
- Syntax needed
- Parameters:
- array: Array
- [index, value]: Array
- index: Number
- value: Anything
- Return Value:
- Return value needed
Alternative Syntax
- Syntax:
- hashMap set [key, value]
- Parameters:
- hashMap : HashMap
- key: HashMapKey
- value: Anything
- Return Value:
- Boolean - false if the key is new to the hashmap, true if a value got overwritten
Examples
- Example 1:
_arrayOne set [0, "Hello"];
- Example 2:
- Append "Bye" as last element to _arrayTwo:
_arrayTwo set [count _arrayTwo, "Bye"];
- Example 3:
- Replace the last element of _arrayThree with 23:
_arrayThree set [(count _arrayThree) - 1, 23];
- Example 4:
- Using set with an index that is out of bounds:
_array = ["A"]; _array set [2, "C"]; // _array is now ["A", nil, "C"] _array set [1, "B"]; // _array is now ["A", "B", "C"]
Additional Information
- See also:
- See also needed
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