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

22 lines
478 B
Plaintext
Raw Normal View History

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