[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua, LuaJIT2 and differences with the length operator
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 4 Jan 2011 19:11:45 -0200
> Should that not better be
>
> if type(k) == 'number' and math.floor(k) == k and 1 <= k and k <= n then
> i = i + 1
> else
> return false
> end
>
> i.e. always return false if we find a non-number key, given the "if t[1]
> is nil, #t can be zero" caveat in the definition of #t?
That's why no solution suits everybody.
- References:
- Re: Lua, LuaJIT2 and differences with the length operator, Leo Razoumov
- Re: Lua, LuaJIT2 and differences with the length operator, Dirk Laurie
- Re: Lua, LuaJIT2 and differences with the length operator, Leo Razoumov
- Re: Lua, LuaJIT2 and differences with the length operator, Roberto Ierusalimschy
- Re: Lua, LuaJIT2 and differences with the length operator, Norbert Kiesel