ACE3/TO_MERGE/cse/main/arrays/functions/fn_findAll.sqf
2015-01-12 23:35:40 +01:00

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;