[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A strange problem with table.sort()
- From: Alen Ladavac <alenl-ml@...>
- Date: Wed, 25 Jul 2007 14:56:30 +0200
> 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?
Cheers,
Alen