lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo <lhf <at> tecgraf.puc-rio.br> writes:

> 
> > next -> function: 00324328
> > pairs{} -> function: 00324FD8      table: 0032F7A8 nil
> 
> That 00324328 is not the same as 00324FD8 does not mean that they're
> not the same C function. In fact, they are; more precisely they're just
> different (but equivalent) closures of the same C function.
> 
> > This patch both the advantage and the disadvantage that if the value
> > of 'next' is changed, then pairs(t) will see that change.
> 
> This may or may not be the right thing or even a good thing: if you mess 'next'
> up, should pairs stop working?
> --lhf
> 

I realize that the use the same C function (luaB_next), and even
mentioned that in my original post.

Lua allows you to "mess up" many things, and in fact this is
considered a feature in many examples (including in PiL 1+2)
in that it allows one to customize behavior of global functions.

In any case, the is a discrepancy between the reference manual
and reality which ought to be addressed.

- Eric