diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.106 2003/10/10 12:57:55 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.107 2003/10/20 18:32:55 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 | */ |
@@ -238,13 +238,13 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
238 | const luaL_reg *l, int nup) { | 238 | const luaL_reg *l, int nup) { |
239 | if (libname) { | 239 | if (libname) { |
240 | /* check whether lib already exists */ | 240 | /* check whether lib already exists */ |
241 | lua_getfield(L, LUA_GLOBALSINDEX, libname); | 241 | lua_getglobal(L, libname); |
242 | if (lua_isnil(L, -1)) { /* no? */ | 242 | if (lua_isnil(L, -1)) { /* no? */ |
243 | lua_pop(L, 1); | 243 | lua_pop(L, 1); |
244 | lua_newtable(L); /* create it */ | 244 | lua_newtable(L); /* create it */ |
245 | lua_pushvalue(L, -1); | 245 | lua_pushvalue(L, -1); |
246 | /* register it with given name */ | 246 | /* register it with given name */ |
247 | lua_setfield(L, LUA_GLOBALSINDEX, libname); | 247 | lua_setglobal(L, libname); |
248 | } | 248 | } |
249 | lua_insert(L, -(nup+1)); /* move library table to below upvalues */ | 249 | lua_insert(L, -(nup+1)); /* move library table to below upvalues */ |
250 | } | 250 | } |