diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-09-29 18:00:25 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-09-29 18:00:25 -0300 |
| commit | cf2a194edc8b1d3e6b342a31d042e1b5fd0d2e8a (patch) | |
| tree | ec4656ebd3b6a2fa65d6cf2f9b917496f552e5a1 | |
| parent | 66845f415feb5aa98be5190c7bf12931d3d4c388 (diff) | |
| download | lua-cf2a194edc8b1d3e6b342a31d042e1b5fd0d2e8a.tar.gz lua-cf2a194edc8b1d3e6b342a31d042e1b5fd0d2e8a.tar.bz2 lua-cf2a194edc8b1d3e6b342a31d042e1b5fd0d2e8a.zip | |
better API for luaL_getfield/setfield
| -rw-r--r-- | lauxlib.h | 6 | ||||
| -rw-r--r-- | ltests.c | 10 |
2 files changed, 8 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.h,v 1.70 2004/07/09 18:23:17 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.71 2004/09/21 16:54:32 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 | */ |
| @@ -72,8 +72,8 @@ LUALIB_API lua_State *(luaL_newstate) (void); | |||
| 72 | 72 | ||
| 73 | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, | 73 | LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, |
| 74 | const char *r); | 74 | const char *r); |
| 75 | LUALIB_API const char *luaL_getfield (lua_State *L, const char *fname); | 75 | LUALIB_API const char *luaL_getfield (lua_State *L, int idx, const char *fname); |
| 76 | LUALIB_API const char *luaL_setfield (lua_State *L, const char *fname); | 76 | LUALIB_API const char *luaL_setfield (lua_State *L, int idx, const char *fname); |
| 77 | 77 | ||
| 78 | 78 | ||
| 79 | 79 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltests.c,v 2.11 2004/08/24 20:12:06 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.12 2004/09/21 16:54:32 roberto Exp roberto $ |
| 3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -1049,8 +1049,8 @@ static int auxgsub (lua_State *L) { | |||
| 1049 | static int auxgetf (lua_State *L) { | 1049 | static int auxgetf (lua_State *L) { |
| 1050 | const char *s = luaL_checkstring(L, 1); | 1050 | const char *s = luaL_checkstring(L, 1); |
| 1051 | lua_settop(L, 2); | 1051 | lua_settop(L, 2); |
| 1052 | lua_pushstring(L, luaL_getfield(L, s)); | 1052 | lua_pushstring(L, luaL_getfield(L, 2, s)); |
| 1053 | lua_assert(lua_gettop(L) == 3); | 1053 | lua_assert(lua_gettop(L) == 4); |
| 1054 | return 2; | 1054 | return 2; |
| 1055 | } | 1055 | } |
| 1056 | 1056 | ||
| @@ -1058,8 +1058,8 @@ static int auxgetf (lua_State *L) { | |||
| 1058 | static int auxsetf (lua_State *L) { | 1058 | static int auxsetf (lua_State *L) { |
| 1059 | const char *s = luaL_checkstring(L, 1); | 1059 | const char *s = luaL_checkstring(L, 1); |
| 1060 | lua_settop(L, 3); | 1060 | lua_settop(L, 3); |
| 1061 | lua_pushstring(L, luaL_setfield(L, s)); | 1061 | lua_pushstring(L, luaL_setfield(L, 2, s)); |
| 1062 | lua_assert(lua_gettop(L) == 2); | 1062 | lua_assert(lua_gettop(L) == 3); |
| 1063 | return 1; | 1063 | return 1; |
| 1064 | } | 1064 | } |
| 1065 | 1065 | ||
