lua-users home
lua-l archive

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


On Mon, 24 May 2010 17:04:53 -0700, Javier Guerra Giraldez <javier@guerrag.com> wrote:

On Sat, May 22, 2010 at 8:13 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
Take the behavior of ipairs(..) in Lua 5.1 and make it a special case
of pairs() in Lua 5.2. What is needed is simply that the language
guarantees that the iterator returned by pairs() will return the
values corresponding to the keys 1 and upwards in order. The order
before that, or the order of any keys after the first nil-valued
integer keys is arbitrary.

This is messy to implement.

i think the current next() implementation first checks the array part
and then the hash table.  doesn't this have the same effect?  or maybe
the guarantees are subtly different and dangerous to rely on?




Numbers aren't guaranteed to be in the array part.