C functions and userdata also have environments
This commit is contained in:
4
linit.c
4
linit.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: linit.c,v 1.7 2004/07/09 14:29:29 roberto Exp roberto $
|
||||
** $Id: linit.c,v 1.8 2004/07/09 15:47:48 roberto Exp roberto $
|
||||
** Initialization of libraries for lua.c
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -32,6 +32,8 @@ LUALIB_API int luaopen_stdlibs (lua_State *L) {
|
||||
for (; lib->func; lib++) {
|
||||
lib->func(L); /* open library */
|
||||
lua_settop(L, 0); /* discard any results */
|
||||
lua_pushvalue(L, LUA_GLOBALSINDEX);
|
||||
lua_replace(L, LUA_ENVIRONINDEX); /* restore environment */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user