Warning: file_put_contents(/ff_a47122bcd6eff77fb48217c269809df7c58312d90e8477c2.php): failed to open stream: Permission denied in /home/ofpecsav/public_html/forum/Sources/Subs-ForumFirewall.php on line 1619
sort - OFPEC Scripting Command Reference | OFPEC The Editing Center

arrayName sort order

Operand types

arrayName: Array
order: Boolean

Type of returned value

Description

Attempts to sort given array either in ascending (true) or descending (false) order.

All array elements should be one of the following types:
String - array of strings (["a","b","c"...])
Number - array of numbers ([1,2,3...])
Array - array of subarrays ([["a",1,2],["b",3,4],["c",5,6]...]).

Subarrays should be of the same structure. Subarray elements other than String or Number will be ignored during sorting.

Mixed arrays (["a",1,[true]...]) are not supported and results are undefined.

order: Boolean - true: ascending, false: descending

Used In

Arma3

Example

_arr = [5.21725,1.30859,4,5.03028,1];
_arr sort true;
hint str _arr; //[1,1.30859,4,5.03028,5.21725]

_dev = ["ja","pa","pa","tram","tara"];
_dev sort false;
hint str _dev; //["tram","tara","pa","pa","ja"]

Advertisement