lua-users home
lua-l archive

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


hm, if o[a] does not exist, I should get 9 in both cases. The
difference should be only when o[a] does exist as far as I can tell.

In any case, I would not expect to get nil as one of the values being sorted.

I understand "don't do that" advice, but in this case it was a
sensible thing to do and I'd like to know more on why this may be not
working before I mark it as a dead end.

Paul.

On Wed, Jun 13, 2012 at 10:54 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2012/6/14 Paul K <paulclinger@yahoo.com>:
>> I suspect so too, but (1) it's not stated anywhere that it's against
>> the rules and (2) changing to "o[a] and 0 or 9" fixes it, which should
>> make no difference.
> It does make a difference.  In the course of the sorting process, you reach
> a point where o[a] does not exist.  As coded now, you will get 0, before
> you would have got 9.  0 is not logically false in Lua.
>