insert

From Bohemia Interactive Community
Jump to navigation Jump to search
Hover & click on the images for descriptions

Description

Description:
Inserts multiple values into Array/String/HashMap.
The String variant also supports forceUnicode.

Syntax

Syntax:
array insert [index, [value1, value2, ...], onlyIfUnique]
Parameters:
array : Array
index: Number - index at which the values will be inserted, -1 for append.
[value1, value2, ...]: Array of Anything - Values to insert at the specified index
onlyIfUnique: Bool - Only insert if the value is unique in the array, like pushBackUnique
Return Value:
Nothing

Alternative Syntax

Syntax:
string insert [index, substring]
Parameters:
string : String
index: Number - index at which the values will be inserted, -1 for append.
substring: String - String to insert
Return Value:
String - The new string

Alternative Syntax 2

Syntax:
hashMap insert [[key1, value1], [key2, value2], ...] Since Arma 3 v2.04
Parameters:
hashMap: HashMap
key: HashMapKey
value: Anything
Return Value:
Nothing

Alternative Syntax 3

Syntax:
hashMap insert [splitArray, [KeysAndValues]] Since Arma 3 v2.04
Parameters:
hashMap: HashMap
splitArray: Boolean - See KeysAndValues
KeysAndValues: Array
  • If splitArray is true then in format [[key1, key2, ...], [value1, value2, ...]]
  • If splitArray is false then [[key1, value1], [key2, value2], ...] Same as alt. syntax 2
Return Value:
Nothing

Examples

Example 1:
"Test" insert [0, "Radio"]; // Returns "RadioTest"

Additional Information

See also:
HashMap
Groups:
HashMapArraysStrings

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