mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
22 lines
477 B
Plaintext
22 lines
477 B
Plaintext
|
/**
|
||
|
* fn_findAll.sqf
|
||
|
* @Descr: Find all elements for which the code returns true
|
||
|
* @Author: Glowbal
|
||
|
*
|
||
|
* @Arguments: [array ARRAY, if CODE (Code called for each element. Should return a bool)]
|
||
|
* @Return: ARRAY Array with elements for which the if code returned true.
|
||
|
* @PublicAPI: true
|
||
|
*/
|
||
|
|
||
|
private ["_array", "_if", "_return"];
|
||
|
_array = _this select 0;
|
||
|
_if = _this select 1;
|
||
|
|
||
|
_return = [];
|
||
|
{
|
||
|
if (_x call _if) then {
|
||
|
_return pushback _x;
|
||
|
};
|
||
|
}foreach _array;
|
||
|
|
||
|
_return;
|