2015-01-16 23:21:47 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-05-14 18:06:06 +00:00
|
|
|
private ["_result", "_value"];
|
|
|
|
PARAMS_1(_array);
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
_result = [];
|
|
|
|
{
|
2015-01-18 19:09:19 +00:00
|
|
|
_value = _x;
|
|
|
|
if ({_x isEqualTo _value} count _result == 0) then {
|
|
|
|
_result pushback _x;
|
|
|
|
};
|
2015-05-14 18:06:06 +00:00
|
|
|
} forEach _array;
|
2015-01-16 23:21:47 +00:00
|
|
|
|
|
|
|
_result;
|