lua-users home
lua-l archive

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


On Fri, Aug 19, 2016 at 6:08 PM, Viacheslav Usov <via.usov@gmail.com> wrote:

> Such use, as the very next sentence in my message explained, makes them dictionaries, not arrays.

This distinction is made in Lua's manual, too.

Unless a __len metamethod is given, the length of a table t is only defined if the table is a sequence, that is, the set of its positive numeric keys is equal to{1..n} for some non-negative integer n. In that case, n is its length. 

(end)

Either a table is a sequence or it is not; it cannot be both at the same time. The term "array" is used officially either in "associative array", or in the part that specifies the C language API, so it was not correct to the term "array" in this discussion at all, but I'm not the only one guilty of that. I think it is safe to say that where we said "array" earlier, we meant "sequence".

Cheers,
V.