lua-users home
lua-l archive

Re: Lua, LuaJIT2 and differences with the length operator

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


> 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.

AltStyle によって変換されたページ (->オリジナル) /