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. At first I thought this might be
because some library I have installed, but I see this behavior also if I
uninstall all my lua add-on packages, and also if I start lua with LUA_PATH set
to the empty string.

> return next
function: 0x1x52c600
> return (pairs({}))
function: 0x1x52c0e0

Why is that? Is one of these a wrapper around the other? Which wraps the
other and what is the wrapper doing?

>From a casual inspection of lbaselib.c in the lua sources, I can't
figure out why it's happening, either. Even the source looks like the
first return value of pairs({}) should be next.

I'm using my own build of lua on x86_64 linux, in case that matters.

-- 
Profjim
profjim@jimpryor.net