Skip to content

array_merge_sort

Hyomoto edited this page Jun 13, 2021 · 2 revisions
Jump To Go Back Arguments

array_merge_sort( array, *sort_or_func )

Returns: [N/A undefined](N/A undefined)

Throws: InvalidArgumentType

An efficient, stable sorting algorithm for arrays. Merge sort is much faster than insertion sort, but uses more space due to it's copying of internal portions of the array. If sort_or_func is true, or not provided, the array will be sorted by ascending value. Setting this to false will use descending logic. If a method is provided, this will be used for the comparison. If an array is not provided to sort, or a non-boolean, non-method is provided for sort, InvalidArgumentType will be thrown.

var _array	= [ 10, 4, 15, 23, 12, 4 ];

array_merge_sort( _array );
Output: [ 4,4,10,12,15,23 ]

Arguments

Name Type Purpose
array array An array to sort
*sort_or_func mixed optional: The sort logic to use

Clone this wiki locally