lua-users home
lua-l archive

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


>In my lua interpreter, the first value returned by pairs({}) 
is not the
>same function as is assigned to next.

Not quite true. 

>From memory, this is caused by duplicate Lua functions. First, 
next() is created which is a pushed C function. When you call 
pairs(), pairs() does not actually query the value of 'next' -
- instead, it pushes the C function lua_next, which causes a 
new Lua function to be created. In essence, we have two 
distinct Lua values which point to the same C function.


-- Matthew P. Del Buono
EcoEagles, Embry-Riddle Aeronautical University