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).