From 86a4de256e88844e34535901d25923aa851d963e Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 7 Feb 2002 15:25:36 -0200 Subject: no more lua_[gs]etstr --- lua.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lua.h') diff --git a/lua.h b/lua.h index 0845a386..ac0a2f96 100644 --- a/lua.h +++ b/lua.h @@ -149,7 +149,6 @@ LUA_API void lua_pushboolean (lua_State *L, int b); /* ** get functions (Lua -> stack) */ -LUA_API void lua_getstr (lua_State *L, int index, const char *name); LUA_API void lua_gettable (lua_State *L, int index); LUA_API void lua_rawget (lua_State *L, int index); LUA_API void lua_rawgeti (lua_State *L, int index, int n); @@ -160,7 +159,6 @@ LUA_API void lua_getmetatable (lua_State *L, int objindex); /* ** set functions (stack -> Lua) */ -LUA_API void lua_setstr (lua_State *L, int index, const char *name); LUA_API void lua_settable (lua_State *L, int index); LUA_API void lua_rawset (lua_State *L, int index); LUA_API void lua_rawseti (lua_State *L, int index, int n); @@ -232,13 +230,6 @@ LUA_API void lua_newuserdatabox (lua_State *L, void *u); #define lua_pushliteral(L, s) lua_pushlstring(L, "" s, \ (sizeof(s)/sizeof(char))-1) -#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) -#define lua_getglobals(L) lua_pushvalue(L, LUA_GLOBALSINDEX) -#define lua_setglobals(L) lua_replace(L, LUA_GLOBALSINDEX) -#define lua_getglobal(L,s) lua_getstr(L, LUA_GLOBALSINDEX, s) -#define lua_setglobal(L,s) lua_setstr(L, LUA_GLOBALSINDEX, s) - - /* ** compatibility macros and functions @@ -246,6 +237,15 @@ LUA_API void lua_newuserdatabox (lua_State *L, void *u); LUA_API int lua_pushupvalues (lua_State *L); +#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) +#define lua_getglobals(L) lua_pushvalue(L, LUA_GLOBALSINDEX) +#define lua_setglobals(L) lua_replace(L, LUA_GLOBALSINDEX) +#define lua_setglobal(L,s) \ + (lua_pushstring(L, s), lua_insert(L, -2), lua_settable(L, LUA_GLOBALSINDEX)) + +#define lua_getglobal(L,s) \ + (lua_pushstring(L, s), lua_gettable(L, LUA_GLOBALSINDEX)) + #define lua_isnull lua_isnone -- cgit v1.2.3-55-g6feb