From Bohemia Interactive Community
Hover & click on the images for description
Description
- Description:
- Attempts to sort given array either in ascending (true) or descending (false) order.
⚠
This will modify the original array!
- Groups:
- Arrays
Syntax
- Syntax:
- array sort order
- Parameters:
- array: Array - array to be sorted, can also be a nested array.
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 - sorting order.
- Return Value:
- Nothing
Examples
- Example 1:
- Example 2:
- Example 3:
- Example 4:
- Sort buildings by distance and return position of the most distant building:
Additional Information
- See also:
- lbSortBy lnbSortBy BIS_fnc_sortAlphabetically BIS_fnc_sortBy BIS_fnc_sortNum
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here!
Add Note
- Killzone_Kid - c
- Posted on Apr 16, 2015 - 18:14 (UTC)
-
The algorithm for sorting subarrays: compare 1st element, if equal compare 2nd, if equal compare 3rd...etc.