2015-01-11 16:42:31 +00:00
|
|
|
/*
|
|
|
|
* Author: KoffeinFlummi, commy2
|
|
|
|
*
|
|
|
|
* Applies given code to every element in an array, LIKE SOMETHING SQF SHOULD HAVE BY DEFAULT.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Array to be thingied.
|
|
|
|
* 1: Code to be applied to every element.
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Final array
|
|
|
|
*
|
|
|
|
* Usage:
|
2015-01-11 18:20:14 +00:00
|
|
|
* [["2", "gobblecock", "25"], {parseNumber _this}] call FUNC(map) ==> [2, 0, 25]
|
2015-01-11 16:42:31 +00:00
|
|
|
*/
|
2015-01-12 18:22:58 +00:00
|
|
|
#include "\z\ace\addons\common\script_component.hpp"
|
2015-01-11 16:42:31 +00:00
|
|
|
|
|
|
|
private ["_array", "_code"];
|
|
|
|
|
|
|
|
_array = + _this select 0;
|
|
|
|
_code = _this select 1;
|
|
|
|
|
|
|
|
if (isNil "_array") exitWith {
|
2015-01-12 04:02:33 +00:00
|
|
|
diag_log text format ["[ACE] ERROR: No array for function map in %1", _fnc_scriptNameParent];
|
2015-01-11 16:42:31 +00:00
|
|
|
[]
|
|
|
|
};
|
|
|
|
|
|
|
|
{
|
|
|
|
_array set [_forEachIndex, _x call _code];
|
|
|
|
} forEach _array;
|
|
|
|
_array
|