lua-users home
lua-l archive

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


On 18 August 2016 at 07:14, Ross Berteig <Ross@cheshireeng.com> wrote:
> But note that it is possible to construct a table in such a way that it has
> only integer keys, and yet nearly all are still stored in the hash table and
> not in the efficient array part. A lot of effort has gone towards making
> such a pathological case difficult to achieve, but there is nothing in the
> spec that forbids that. Such a table would iterate keys in a completely
> arbitrary order with lua_next().

Would it be reasonable to assume you will be OK if you don’t construct
the array part of your table “pathologically”?

But unless the table had non-array-like items that I wanted to iterate
over as well, I would keep track of the key myself.

Vaughan