lua-users home
lua-l archive

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


On Thu, Jun 4, 2015 at 6:26 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> Imagine that the concept of "sequence" only came in with Lua 5.3,
>> when integers are already distinguished and are preferred over
>> floats of equal value as table keys. Surely the definition would
>> in that case have been formulated in terms of integes.
>
> Following that reasoning, would the following be a sequence too?
>
>   seq = {10, 20, 30, [2^63] = 40}
>
> After all, 2^63 is not an integer key.
>

#seq returns 3 for Lua versions 5.1, 5.2, 5.3. Iterating over sequence
items using ipairs and "for i = 1, #seq" works. Is there a good reason
not to consider this table a sequence?



-- 


Best regards,
Boris Nagaev