In Part 1 we have mostly looked at how to retrieve information from arrays. In this part we are going to look at changing and manipulating array. But first let’s look at two more array related commands you will need when dealing with class config entries, getArray and isArray. getArray will force output in the correct type (array) but will not convert it. For example if you have config entry as a string “sometextstring”, getArray will return  and not ["sometextstring"]. isArray will simply tell you if the config entry is array or not.
To change the value of array element use set command. This command takes array of arguments [index, newvalue]. set will also resize array if you change value of element beyond the length of array. You can also resize an array directly with resize command. resize will either truncate or extend the array depending on the length argument you supply.
You can undefine array element by assigning nil to it. This will neither erase the element nor will it alter the length of the array.
There is no direct way of removing elements from array resulting in array length changes. However there are several workarounds based on another great feature of ArmA arrays. You can simply add and subtract arrays with + and - operators. Addition will just do that add the 2nd array to the 1st array changing the 1st array length to accommodate new values.
Subtraction will remove ALL elements of the 2nd array from the 1st array changing the length of the 1st array.
If array element is array itself it cannot be subtracted.
So to remove a single element of array you need to first change it to some unique to this array value then subtract this value. Assigning and subtracting Null objects such as objNull, locationNull, grpNull, taskNull, teamMemberNull, controlNull, displayNull works too.
Here is a neat trick for you when you want to add an element to array but want to make sure its value stays unique and doesn’t repeat. You can check if match exists of course before adding new element, or you simply assume the value exists, subtract it first before adding it again. This will ensure it will not repeat within the array.
This is it for the Part 2. Part 3 will deal with some more advanced stuff.