append: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Killzone Kid (talk | contribs) (example) |
||
Line 59: | Line 59: | ||
_arr [[append]] _tmp; | _arr [[append]] _tmp; | ||
_arr | _arr | ||
};</code> | }; | ||
// Example | |||
arr <nowiki>=</nowiki> [1,2,3]; | |||
[arr, 0] [[call]] KK_fnc_unshift; //both arr and return of function are [0,1,2,3] | |||
</code> | |||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 11:32, 21 May 2015
Description
- Description:
- Appends array2 to the back of array1 modifying array1.
- Groups:
- Uncategorised
Syntax
Examples
Additional Information
- See also:
- setpushBackresizereversecountfindinforEachdeleteAtdeleteRangesortBIS_fnc_arrayPushStackBIS_fnc_arrayPush
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 March 9, 2015 - 00:41 (UTC)
- Heeeere's Johnny!
-
_array1 append _array2
is roughly 1.2x faster (depending on array size) than_array1 = _array1 + _array2
(Averaged over 10.000 iterations with two identical arrays containing the numbers 0 through 9)
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)
- Killzone Kid
-
Array "unshift" implementation using append, alternative to BIS_fnc_arrayUnShift
KK_fnc_unshift = { private ["_arr", "_tmp"]; _arr = _this select 0; _tmp = [_this select 1]; _tmp append _arr; _arr resize 0; _arr append _tmp; _arr }; // Example arr = [1,2,3]; [arr, 0] call KK_fnc_unshift; //both arr and return of function are [0,1,2,3]