apply: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) (Created page with "{{Command|= Comments ____________________________________________________________________________________________ | arma3dev |= Game name |1.55|= Game version _____________...") |
Killzone Kid (talk | contribs) (see also) |
||
Line 27: | Line 27: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| [[set]], [[resize]], [[pushBack]], [[reverse]], [[count]], [[find]], [[in]], [[forEach]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[arrayIntersect]], [[BIS_fnc_arrayPushStack]], [[BIS_fnc_arrayPush]] |= See also | | [[set]], [[resize]], [[pushBack]], [[pushBackUnique]], [[select]], [[reverse]], [[count]], [[find]], [[in]], [[forEach]], [[deleteAt]], [[deleteRange]], [[append]], [[sort]], [[arrayIntersect]], [[BIS_fnc_arrayPushStack]], [[BIS_fnc_arrayPush]] |= See also | ||
}} | }} |
Revision as of 11:44, 16 January 2016
Description
- Description:
- Applies given code to each element of the array and returns resulting array. The value of the current array element, to which the code will be applied, is stored in variable _x.
- Groups:
- Uncategorised
Syntax
- Syntax:
- array apply code
- Parameters:
- array: Array - array of Anything
- code: Code - code to be executed on each element of the array. Current element value is stored in variable _x
- Return Value:
- Array - resulting array
Examples
- Example 1:
_arr = [1,2,3,4,5,6,7,8,9,0] apply {[1,0] select (_x % 2 == 0)}; //[1,0,1,0,1,0,1,0,1,0]
- Example 2:
_arr = [1,2,3,4,5,6,7,8,9,0] apply {_x ^ _x}; //[1,4,27,256,3125,46656,823543,16777216,387420480,1]
- Example 3:
_arr1 = []; _arr1 resize 20; _arr2 = _arr1 apply {0}; //[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Additional Information
- See also:
- setresizepushBackpushBackUniqueselectreversecountfindinforEachdeleteAtdeleteRangeappendsortarrayIntersectBIS_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
[[Category:Introduced with arma3dev version 1.55]][[ Category: arma3dev: New Scripting Commands | APPLY]][[ Category: arma3dev: Scripting Commands | APPLY]]