GSC reference › Built-in
ArrayInsert()
Built-in (engine)
Server + client
Utility
Insert a value into an array at a given index
Signature
ArrayInsert(<array>, <value>, <index>)
Parameters
| Name | Required? | Details |
|---|---|---|
| array | Required | array to operate on |
| value | Required | value to insert |
| index | Required | index at which to insert the value (must be an integer) - moves existing entries as required |
Real uses in BO3's scripts
Called 63 times in the decompiled scripts. A few, zombies first:
- scripts/zm/_zm_altbody_beast.csc, line 665
arrayinsert(a, self, a.size); - scripts/zm/_zm_magicbox.gsc, line 1299
arrayinsert(keys, forced_weapon, 0); - scripts/zm/_zm_perk_random.gsc, line 678
arrayinsert(keys, forced_perk, 0); - scripts/zm/_zm_pers_upgrades_functions.gsc, line 1174
arrayinsert(keys, forced_weapon, 0); - scripts/zm/_zm_unitrigger.gsc, line 1065
arrayinsert(triggers, array[i], j);
Related built-ins
- AllowTacticalInsertion()If false, disallows tactical insertions in the bounding area of this entity.
- array()Create an array
- Assert()Assert that the given statement is correct.
- GetDvarInt()Gets the value of a dvar.
- IsArray()Checks whether this entity/variable is an array
- GetDvarString()Gets the value of a dvar.
- ArrayRemoveValue()Remove a value from an array (may affect multiple indexes)
- GetDvarFloat()Gets the value of a dvar.
- IsSubStr()Returns true/false if <substring> is a substring of <string>.
- GetArrayKeys()Returns an array consisting of the keys of the input array.
- ArrayCombine()Combine two arrays into and returns one new array
- IsInArray()Searches an array to determine if a given value is present in that array
New to GSC?
Start with the basics, or paste a compile error to get the fix.
Built-in descriptions, parameters and examples come from Treyarch's BO3 mod tools docs. Usage links point at shiversoftdev/t7-source (decompiled BO3 scripts).