From fa198197a0202bd3a7b68d228cd1c2fd88166ff7 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 5 Nov 2003 09:59:14 -0200 Subject: lua_(set)getglobal are ok to use --- lauxlib.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index d441f4fe..8dff62d9 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1,5 +1,5 @@ /* -** $Id: lauxlib.c,v 1.106 2003/10/10 12:57:55 roberto Exp roberto $ +** $Id: lauxlib.c,v 1.107 2003/10/20 18:32:55 roberto Exp roberto $ ** Auxiliary functions for building Lua libraries ** See Copyright Notice in lua.h */ @@ -238,13 +238,13 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, const luaL_reg *l, int nup) { if (libname) { /* check whether lib already exists */ - lua_getfield(L, LUA_GLOBALSINDEX, libname); + lua_getglobal(L, libname); if (lua_isnil(L, -1)) { /* no? */ lua_pop(L, 1); lua_newtable(L); /* create it */ lua_pushvalue(L, -1); /* register it with given name */ - lua_setfield(L, LUA_GLOBALSINDEX, libname); + lua_setglobal(L, libname); } lua_insert(L, -(nup+1)); /* move library table to below upvalues */ } -- cgit v1.2.3-55-g6feb