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

22 lines
478 B
Plaintext

/**
* fn_findIn.sqf
* @Descr: Get the index of the first element that is equal to compare value
* @Author: Glowbal
*
* @Arguments: [array ARRAY, value ANY (The compared value)]
* @Return: NUMBER (-1 is not found. Else index of element in array)
* @PublicAPI: true
*/
private ["_array", "_value", "_return"];
_array = _this select 0;
_value = _this select 1;
_return = -1;
{
if (_x isEqualTo _value) exitwith {
_return = _foreachIndex;
};
}foreach _array;
_return;