ACE3/addons/common/functions/fnc_insertionSort.sqf
2016-07-25 20:00:41 +02:00

23 lines
426 B
Plaintext

/*
* Author: Ruthberg
* Sorts an array of numbers
*
* Arguments:
* 0: array <ARRAY>
* 1: ascending (optional) <BOOL>
*
* Return Value:
* sortedArray (ARRAY)
*
* Public: No
*/
#include "script_component.hpp"
ACE_DEPRECATED(QFUNC(insertionSort),"3.8.0","sort");
params [["_list", [], [[]]], ["_ascending", true, [false]]];
_list = + _list; // copy array to not alter the original one
_list sort _ascending;
_list