append: Difference between revisions
No edit summary  | 
				Lou Montana (talk | contribs)   | 
				||
| Line 23: | Line 23: | ||
</sqf>  | </sqf>  | ||
|seealso= [[set]] [[pushBack]] [[pushBackUnique]] [[insert]] [[  | |seealso= [[set]] [[pushBack]] [[pushBackUnique]] [[insert]] [[+]] [[apply]] [[select]] [[resize]] [[reverse]] [[count]] [[deleteAt]] [[deleteRange]]  | ||
}}  | }}  | ||
Latest revision as of 18:52, 9 August 2022
Description
- Description:
 - Appends array2 to the back of array1 modifying array1. See insert for an "appendUnique" equivalent.
 - Groups:
 - Arrays
 
Syntax
Examples
- Example 1:
 
Additional Information
- See also:
 - set pushBack pushBackUnique insert + apply select resize reverse count deleteAt deleteRange
 
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 
- Posted on Mar 09, 2015 - 00:41 (UTC)
 - 
is roughly 1.2× faster (depending on array size) than (Averaged over 10.000 iterations with two identical arrays containing the numbers 0 through 9)_array1 append _array2;
The larger the arrays to append, the faster append is as it does not create a new array, which happens with array addition. 
- Posted on May 21, 2015 - 10:27 (UTC)
 - Array "unshift" implementation using append, a faster alternative to BIS_fnc_arrayUnShift:
 
- Posted on May 21, 2015 - 15:21 (UTC)
 - 
Array "insert" implementation using append, much faster alternative to BIS_fnc_arrayInsert:
KK_fnc_insert = { private ["_arr", "_i", "_res"]; _arr = _this select 0; _i = _this select 2; _res = []; _res append (_arr select [0, _i]); _res append (_this select 1); _res append (_arr select [_i, count _arr - _i]); _res; }; // Example arr = [1,2,3,4]; [arr, ["a","b"], 2] call KK_fnc_insert; // [1,2,"a","b",3,4]
 
- Posted on May 21, 2015 - 15:52 (UTC)
 - A faster alternative to BIS_fnc_arrayPushStack using append: