[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: assert in luaopen_io()
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 11 Apr 2005 11:37:41 -0300
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
> Has the convention for opening the standard libs changed?
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).