diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.241 2012/03/18 16:52:49 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.242 2012/03/19 22:57:14 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -892,10 +892,8 @@ LUALIB_API void luaL_requiref (lua_State *L, const char *modname, | |||
892 | lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ | 892 | lua_setfield(L, -2, modname); /* _LOADED[modname] = module */ |
893 | lua_pop(L, 1); /* remove _LOADED table */ | 893 | lua_pop(L, 1); /* remove _LOADED table */ |
894 | if (glb) { | 894 | if (glb) { |
895 | lua_pushglobaltable(L); | 895 | lua_pushvalue(L, -1); /* copy of 'mod' */ |
896 | lua_pushvalue(L, -2); /* copy of 'mod' */ | 896 | lua_setglobal(L, modname); /* _G[modname] = module */ |
897 | lua_setfield(L, -2, modname); /* _G[modname] = module */ | ||
898 | lua_pop(L, 1); /* remove _G table */ | ||
899 | } | 897 | } |
900 | } | 898 | } |
901 | 899 | ||