diff options
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.279 2011/08/23 17:24:34 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.280 2011/10/24 14:54:05 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 |
@@ -215,6 +215,7 @@ LUA_API int (lua_pushthread) (lua_State *L); | |||
215 | /* | 215 | /* |
216 | ** get functions (Lua -> stack) | 216 | ** get functions (Lua -> stack) |
217 | */ | 217 | */ |
218 | LUA_API void (lua_getglobal) (lua_State *L, const char *var); | ||
218 | LUA_API void (lua_gettable) (lua_State *L, int idx); | 219 | LUA_API void (lua_gettable) (lua_State *L, int idx); |
219 | LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); | 220 | LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k); |
220 | LUA_API void (lua_rawget) (lua_State *L, int idx); | 221 | LUA_API void (lua_rawget) (lua_State *L, int idx); |
@@ -229,6 +230,7 @@ LUA_API void (lua_getuservalue) (lua_State *L, int idx); | |||
229 | /* | 230 | /* |
230 | ** set functions (stack -> Lua) | 231 | ** set functions (stack -> Lua) |
231 | */ | 232 | */ |
233 | LUA_API void (lua_setglobal) (lua_State *L, const char *var); | ||
232 | LUA_API void (lua_settable) (lua_State *L, int idx); | 234 | LUA_API void (lua_settable) (lua_State *L, int idx); |
233 | LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); | 235 | LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); |
234 | LUA_API void (lua_rawset) (lua_State *L, int idx); | 236 | LUA_API void (lua_rawset) (lua_State *L, int idx); |
@@ -316,13 +318,6 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | |||
316 | 318 | ||
317 | #define lua_newtable(L) lua_createtable(L, 0, 0) | 319 | #define lua_newtable(L) lua_createtable(L, 0, 0) |
318 | 320 | ||
319 | #define lua_setglobal(L,s) \ | ||
320 | (lua_pushglobaltable(L), lua_pushvalue(L, -2), \ | ||
321 | lua_setfield(L, -2, (s)), lua_pop(L, 2)) | ||
322 | |||
323 | #define lua_getglobal(L,s) \ | ||
324 | (lua_pushglobaltable(L), lua_getfield(L, -1, (s)), lua_remove(L, -2)) | ||
325 | |||
326 | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) | 321 | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) |
327 | 322 | ||
328 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | 323 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |