lua-users home
lua-l archive

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


On Sat, Jul 23, 2016 at 10:09 AM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> Many people on this list say tables have an "array" and a "hash" part.
>
> That is an implementation detail. Even if the table is a sequence, it may
> happen that part of it is in the hash part.

I think that's the entire point.

The comment seems to be that regardless of those implementation
details, conceptually speaking tables DO have a "sequence" part (the
set of integral-valued keys starting at 1 and going up until a nil is
found or until the __len metamethod says to stop) and a "map" part
(everything else). The "sequence" part can be deterministically
iterated over, while the "map" part is meant to be random-access and
if iteration is deterministic that's a coincidence of implementation.

/s/ Adam