lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> I have some data which if I sort it only once, the result is not
> correct (i.e. some fields are at wrong places), and if I sort it
> twice, it is correct.

> On the other hand, for some other data, if I try to sort it twice, on
> the second pass the comparator will receive nil for one of its inputs.

I have found the cause of this to be in the comparator function. It
_must_ return false for elements that are equal, otherwise the results
are just like this: either unsorted array, or array containing nils.

Perhaps this should be mentioned in the docs?