[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairs(t, skey) and ipairs(t, skey)
- From: Tim Hill <drtimhill@...>
- Date: Tue, 1 Oct 2013 17:16:17 -0700
On Oct 1, 2013, at 11:57 AM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>> One of the incorrect assumptions I had was that ipairs(t) would
>> produce the same keys as 1..#t, but it's clearly not the case as 1..#t
>> may iterate over holes, but ipairs never does this (at least in Lua 5.1).
>
> The bottom line is: don't use #t or ipairs if you have holes in your table.
>
.. and I know I'll get shot down for saying it again, but I still feel the lack of an efficient way to determine if a table t is a sequence is a significant hole in the language/runtime.
--Tim