BIS fnc sortBy: Difference between revisions
Jump to navigation
Jump to search
m (GVI http://dev.arma3.com/post/spotrep-00004 First mentioned here, could be 0.50 (no evidence)) |
(see also) |
||
Line 61: | Line 61: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| |= See also | | [[BIS_fnc_sortAlphabetically]], [[BIS_fnc_sortNum]], [[sort]] |= See also | ||
}} | }} |
Revision as of 21:47, 18 April 2015
Description
- Description:
/* Description: Sorts an array according to given algorithm. Parameter(s): _this select 0: any unsorted array (Array) - array can contain any types (object/numbers/strings ..) _this select 1: input parameters (Array) - used in the eval algorithm (object/numbers/strings ..) - input params are referenced in the sorting algorithm by _input0, _input1 .. _input9 - max. number of 10 input params is supported (0-9) _this select 2: sorted algorithm (Code) [optional: default {_x}] - code needs to return a scalar - variable _x refers to array item _this select 3: sort direction (String) [optional: default "ASCEND"] "ASCEND": sorts array in ascending direction (from lowest value to highest) "DESCEND": sorts array in descending direction _this select 4: filter (Code) [optional: default {true}] - code that needs to evaluate true for the array item to be sorted, otherwise item is removed Returns: Array Examples: //sort numbers from lowest to highest _sortedNumbers = [[1,-80,0,480,15,-40],[],{_x},"ASCEND"] call BIS_fnc_sortBy; //sort helicopters by distance from player _closestHelicopters = [[_heli1,_heli2,_heli3],[],{player distance _x},"ASCEND"] call BIS_fnc_sortBy; //sort enemy by distance from friendly unit (referenced by local variable), the furtherest first _furtherstEnemy = [[_enemy1,_enemy2,_enemy3],[_friendly],{_input0 distance _x},"DESCEND",{canMove _x}] call BIS_fnc_sortBy; */
(Placeholder description extracted from the function header by BIS_fnc_exportFunctionsToWiki)- Execution:
- call
- Groups:
- Uncategorised
Syntax
- Syntax:
- Syntax needed
- Return Value:
- Return value needed
Examples
- Example 1:
Additional Information
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