ACE3/TO_MERGE/cse/main/arrays/functions/fn_findAll.sqf

22 lines
477 B
Plaintext
Raw Normal View History

2015-01-12 22:35:40 +00:00
/**
* 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;