lua-users home
lua-l archive

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


This is a small bug...

> An assertion in luaopen_io() seems strange because I'd assume
> that almost every Lua 5.1w5 user who enables assertions would be
> seeing it.

Not always. lua.c, for instance, uses lua_cpcall, which hiddens the
problem.


> Has the convention for opening the standard libs changed?

Yes :(

Now C libraries can have their own environments; so, some luaopen_xxx
functions can change their environments to propagate the new environment
to the functions they create. However, when a luaopen_xxx is called
directly from the main program (the usual thing in the case of the
standard libraries), the environment they are changing is the main
program environment. This is by itself bad (for now luaopen_stdlibs
undoes the change, but this is a hack), but becomes an error if the
"main program" is not a C function (as in your code).

-- Roberto