details (using lua_setglobal/lua_getglobal instead of explicit
use of the global table)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lauxlib.c,v 1.241 2012/03/18 16:52:49 roberto Exp roberto $
|
||||
** $Id: lauxlib.c,v 1.242 2012/03/19 22:57:14 roberto Exp roberto $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -892,10 +892,8 @@ LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
|
||||
lua_setfield(L, -2, modname); /* _LOADED[modname] = module */
|
||||
lua_pop(L, 1); /* remove _LOADED table */
|
||||
if (glb) {
|
||||
lua_pushglobaltable(L);
|
||||
lua_pushvalue(L, -2); /* copy of 'mod' */
|
||||
lua_setfield(L, -2, modname); /* _G[modname] = module */
|
||||
lua_pop(L, 1); /* remove _G table */
|
||||
lua_pushvalue(L, -1); /* copy of 'mod' */
|
||||
lua_setglobal(L, modname); /* _G[modname] = module */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user