Ar CustomSort

Revision as of 17:57, 7 June 2012 by imported>QQuix (New page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
< [[::Category:Functions|Category:Functions]]

A function added by the Oblivion Script Extender.

Syntax:

(sorted:Array) Ar_CustomSort toSort:Array comparisonFunction:ref reverse:bool

Returns an Array sorted by calling the provided function script to perform comparison of elements.

The function should be defined to take two array_var arguments. When it is called, the arguments will contain exactly one element each - the elements to be compared.

It should return true if the first argument is less than the second argument, and true if it is greater than or equal to the second argument.

You can define 'less', 'greater', and 'equal' in whatever way makes sense for you provided your definitions provide a definitive ordering of any set of values; otherwise the sort may never terminate.

The optional third argument sorts the elements in reverse order.


See Also