diff options
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.260 2010/01/06 15:08:00 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.261 2010/01/11 17:15:11 roberto Exp roberto $ |
3 | ** Lua - A Scripting Language | 3 | ** Lua - A Scripting Language |
4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
5 | ** See Copyright Notice at the end of this file | 5 | ** See Copyright Notice at the end of this file |
@@ -297,8 +297,12 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
297 | 297 | ||
298 | #define lua_newtable(L) lua_createtable(L, 0, 0) | 298 | #define lua_newtable(L) lua_createtable(L, 0, 0) |
299 | 299 | ||
300 | #define lua_setglobal(L,s) lua_setfield(L, LUA_ENVIRONINDEX, (s)) | 300 | #define lua_setglobal(L,s) \ |
301 | #define lua_getglobal(L,s) lua_getfield(L, LUA_ENVIRONINDEX, (s)) | 301 | (lua_pushglobaltable(L), lua_pushvalue(L, -2), \ |
302 | lua_setfield(L, -2, (s)), lua_pop(L, 2)) | ||
303 | |||
304 | #define lua_getglobal(L,s) \ | ||
305 | (lua_pushglobaltable(L), lua_getfield(L, -1, (s)), lua_remove(L, -2)) | ||
302 | 306 | ||
303 | #define lua_register(L,n,f) \ | 307 | #define lua_register(L,n,f) \ |
304 | (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_ENVIRONINDEX, (n))) | 308 | (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_ENVIRONINDEX, (n))) |