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

22 lines
421 B
Plaintext
Raw Normal View History

2015-01-12 22:35:40 +00:00
/**
* fn_uniqueElementsOnly.sqf
* @Descr: Make a copy of an array with only the unique elements.
* @Author: Glowbal
*
* @Arguments: [array ARRAY]
* @Return: ARRAY Copy of original array
* @PublicAPI: true
*/
private ["_array", "_result", "_value"];
_array = _this select 0;
_result = [];
{
_value = _x;
if ({_x isEqualTo _value} count _result == 0) then {
_result pushback _x;
};
}foreach _array;
_result;