native

ArraySort

Syntax

native ArraySort(Array:array, const comparefunc[], data[]="", data_size=0);

Description

Similar to sorting.inc's CustomSort.
The sorting algorithm then uses your comparison function to sort the data.
The function is called in the following manner:

public MySortFunc(Array:array, item1, item2, const data[], data_size)

array - Array handle in its current un-sorted state.
item1, item2 - Current item pair being compared
data[] - Extra data array you passed to the sort func.
data_size - Size of extra data you passed to the sort func.

Your function should return:
-1 if item1 should go before item2
0 if item1 and item2 are equal
1 if item1 should go after item2
Note that the parameters after item2 are all optional and you do not need to specify them.

Note that unlike the sorting.inc versions, the array passed to the callback is not in mid-sorted state.