mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
21 lines
468 B
Plaintext
21 lines
468 B
Plaintext
|
/**
|
||
|
* fn_foreachDo.sqf
|
||
|
* @Descr: Execute code for each element in an array and collect the return values.
|
||
|
* @Author: Glowbal
|
||
|
*
|
||
|
* @Arguments: [array ARRAY, do CODE (Code executed for each element)]
|
||
|
* @Return: ARRAY Array with return values.
|
||
|
* @PublicAPI: true
|
||
|
*/
|
||
|
#include "script_component.hpp"
|
||
|
private ["_array", "_do", "_return"];
|
||
|
_array = _this select 0;
|
||
|
_do = _this select 1;
|
||
|
|
||
|
_return = [];
|
||
|
{
|
||
|
_return pushback(_x call _do);
|
||
|
false;
|
||
|
}count _array;
|
||
|
|
||
|
_return;
|