set: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - " {3,}\|" to " |") |
Lou Montana (talk | contribs) m (Text replacement - " {2,}\}\}" to " }}") |
||
Line 42: | Line 42: | ||
| [[Array]], [[plus a]], [[valuea plus valueb]], [[a - b]], [[resize]], [[reverse]], [[select]], [[in]], [[find]], [[findIf]], [[toArray]], [[toString]], [[forEach]], [[count]], [[pushBack]], [[pushBackUnique]], [[apply]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[param]], [[params]], [[arrayIntersect]], [[splitString]], [[joinString]] | | [[Array]], [[plus a]], [[valuea plus valueb]], [[a - b]], [[resize]], [[reverse]], [[select]], [[in]], [[find]], [[findIf]], [[toArray]], [[toString]], [[forEach]], [[count]], [[pushBack]], [[pushBackUnique]], [[apply]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[param]], [[params]], [[arrayIntersect]], [[splitString]], [[joinString]] | ||
}} | }} | ||
Revision as of 00:40, 19 January 2021
Description
- Description:
- Changes the element at the given (zero-based) index of the array.
If the index is out of bounds, the array will resize to incorporate the index as its last value, padding with nil as necessary. See Example 4. - Groups:
- Arrays
Syntax
- Syntax:
- array set [index, value]
- Parameters:
- array: Array
- [index, value]: Array
- index: Number
- value: Anything
- Return Value:
- Nothing
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:
- Arrayplus avaluea plus valueba - bresizereverseselectinfindfindIftoArraytoStringforEachcountpushBackpushBackUniqueapplydeleteAtdeleteRangeappendsortparamparamsarrayIntersectsplitStringjoinString
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
Categories:
- Scripting Commands
- Introduced with Operation Flashpoint: Resistance version 1.75
- Operation Flashpoint: Resistance: New Scripting Commands
- Operation Flashpoint: Resistance: Scripting Commands
- Command Group: Arrays
- Scripting Commands OFP 1.99
- Scripting Commands OFP 1.96
- ArmA: Armed Assault: Scripting Commands
- Arma 2: Scripting Commands
- Arma 3: Scripting Commands
- Take On Helicopters: Scripting Commands