[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pairs(t, skey) and ipairs(t, skey)
- From: Leo Razoumov <slonik.az@...>
- Date: Thu, 3 Oct 2013 06:50:23 -0400
Actually, I just recalled that we had an extensive discussion of
Lua table semantics back in 2011 [1] and Henning Diedrich submitted
a patch [2] that can quickly answer the question whether the array
part has holes.
IIRC, we even did a full test of the patch using the Lua test-suit
and found no problems.
[1] https://groups.google.com/d/msg/lua-table-semantics/PMPUR5RO9Ek/2Hf40XMIdqEJ
[2] http://eonblast.com/trucount/
--Leo--
On 10/3/13, Leo Razoumov <slonik.az@gmail.com> wrote:
> On 10/2/13, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
>>> Another habit we should not be practicing is thinking of Lua tables as
>>> having
>>> array and hash parts.
>>
>> Exactly. This is an implementation detail for getting performance and
>> reduced
>> memory usage but Lua tables remain what they are: associative arrays.
>>
>
> Unfortunately, Lua itself encourages such a separation and provides both
> pairs and ipairs to reinforce the distinction.
>
> --Leo--
>
- References:
- pairs(t, skey) and ipairs(t, skey), Andrew Starks
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- Re: pairs(t, skey) and ipairs(t, skey), Tom N Harris
- Re: pairs(t, skey) and ipairs(t, skey), Luiz Henrique de Figueiredo
- Re: pairs(t, skey) and ipairs(t, skey), Leo Razoumov