diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-01-23 09:34:18 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-01-23 09:34:18 -0200 |
commit | 797d964df9c0b1bf09338cea3d578f1985fe2ee0 (patch) | |
tree | 7818d8dd3ded328dbb85594e1fa2bde6e02e243e /lauxlib.c | |
parent | e44e579dc19ec0060f5e84c7a692b5c1cff2eec3 (diff) | |
download | lua-797d964df9c0b1bf09338cea3d578f1985fe2ee0.tar.gz lua-797d964df9c0b1bf09338cea3d578f1985fe2ee0.tar.bz2 lua-797d964df9c0b1bf09338cea3d578f1985fe2ee0.zip |
detail
Diffstat (limited to '')
-rw-r--r-- | lauxlib.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.90 2002/11/14 15:41:38 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.91 2002/12/04 17:38:31 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 | */ |
@@ -176,6 +176,9 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
176 | if (lua_isnil(L, -1)) { /* no? */ | 176 | if (lua_isnil(L, -1)) { /* no? */ |
177 | lua_pop(L, 1); | 177 | lua_pop(L, 1); |
178 | lua_newtable(L); /* create it */ | 178 | lua_newtable(L); /* create it */ |
179 | lua_pushstring(L, libname); | ||
180 | lua_pushvalue(L, -2); | ||
181 | lua_settable(L, LUA_GLOBALSINDEX); /* register it with given name */ | ||
179 | } | 182 | } |
180 | lua_insert(L, -(nup+1)); /* move library table to below upvalues */ | 183 | lua_insert(L, -(nup+1)); /* move library table to below upvalues */ |
181 | } | 184 | } |
@@ -188,11 +191,6 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
188 | lua_settable(L, -(nup+3)); | 191 | lua_settable(L, -(nup+3)); |
189 | } | 192 | } |
190 | lua_pop(L, nup); /* remove upvalues */ | 193 | lua_pop(L, nup); /* remove upvalues */ |
191 | if (libname) { | ||
192 | lua_pushstring(L, libname); | ||
193 | lua_pushvalue(L, -2); | ||
194 | lua_settable(L, LUA_GLOBALSINDEX); | ||
195 | } | ||
196 | } | 194 | } |
197 | 195 | ||
198 | 196 | ||