new API functions lua_getstr/lua_setstr

This commit is contained in:
Roberto Ierusalimschy
2001-12-10 20:09:51 -02:00
parent 592a309177
commit 9cd36059ad
7 changed files with 30 additions and 45 deletions

10
lua.h
View File

@@ -146,7 +146,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
/*
** get functions (Lua -> stack)
*/
LUA_API void lua_getglobal (lua_State *L, const char *name);
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);
@@ -158,7 +158,7 @@ LUA_API void lua_geteventtable (lua_State *L, int objindex);
/*
** set functions (stack -> Lua)
*/
LUA_API void lua_setglobal (lua_State *L, const char *name);
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);
@@ -227,8 +227,10 @@ LUA_API int lua_getweakmode (lua_State *L, int index);
#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_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
#define lua_getglobals(L) lua_pushvalue(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)