Use this number to resize the array to the number of elements desired, not the desired index of the final element.
resize cannot be used to create a new array.
Also available as Markdown and JSON, or read the original wiki page.
Changes the size of the given array. The command does not return new array, it resizes the source array to the desired number of elements. If the new size is bigger than the current size, the new places are filled with nil. The alternative syntax allows to fill resized positions with a given value. Array and HashMap values are copied.
array resize count
Parameters:
Returns: Nothing
since arma3 2.10
array resize [count, fill]
Parameters:
array: Array of Anythingcount: Number - the new array sizefill: Anything - value to fill added positionsReturns: Nothing
_arrayNum = [0,1,2,3,4];
_arrayNum resize 2; // _arrayNum is now [0, 1]
_arrayNum resize 5; // _arrayNum is now [0, 1, nil, nil, nil]
private _array = [0, 1, 2];
_array resize [5, -1]; // _array is now [0, 1, 2, -1, -1]
private _array = [0, 1, 2];
_array resize [1, -1]; // _array is now [0]
private _array = [0, 1, 2];
_array resize [4, "something"]; // _array is now [0, 1, 2, "something"]
set · reverse · deleteAt · deleteRange
Use this number to resize the array to the number of elements desired, not the desired index of the final element.
resize cannot be used to create a new array.