diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-26 16:17:57 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-05-26 16:17:57 -0300 |
commit | 8e617985fab860fcd045f6f345ef47b159446d3b (patch) | |
tree | b4b094aae7e962ea6e4a8f68c8f5dd31f97d4fdf /lapi.c | |
parent | c39345fba361257bc426cd042a39691a0d68d68a (diff) | |
download | lua-8e617985fab860fcd045f6f345ef47b159446d3b.tar.gz lua-8e617985fab860fcd045f6f345ef47b159446d3b.tar.bz2 lua-8e617985fab860fcd045f6f345ef47b159446d3b.zip |
functions `for...' and `raw...' are obsolete now
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 52 |
1 files changed, 30 insertions, 22 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.80 2000/05/08 20:49:05 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.81 2000/05/24 13:54:49 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -120,11 +120,11 @@ lua_Object lua_gettable (lua_State *L) { | |||
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | lua_Object lua_rawgettable (lua_State *L) { | 123 | lua_Object lua_rawget (lua_State *L) { |
124 | lua_Object res; | 124 | lua_Object res; |
125 | luaA_checkCargs(L, 2); | 125 | luaA_checkCargs(L, 2); |
126 | if (ttype(L->top-2) != TAG_TABLE) | 126 | if (ttype(L->top-2) != TAG_TABLE) |
127 | lua_error(L, "indexed expression not a table in rawgettable"); | 127 | lua_error(L, "indexed expression not a table"); |
128 | res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1)); | 128 | res = luaA_putluaObject(L, luaH_get(L, avalue(L->top-2), L->top-1)); |
129 | L->top -= 2; | 129 | L->top -= 2; |
130 | return res; | 130 | return res; |
@@ -140,7 +140,7 @@ void lua_settable (lua_State *L) { | |||
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | void lua_rawsettable (lua_State *L) { | 143 | void lua_rawset (lua_State *L) { |
144 | luaA_checkCargs(L, 3); | 144 | luaA_checkCargs(L, 3); |
145 | if (ttype(L->top-3) != TAG_TABLE) | 145 | if (ttype(L->top-3) != TAG_TABLE) |
146 | lua_error(L, "indexed expression not a table"); | 146 | lua_error(L, "indexed expression not a table"); |
@@ -170,24 +170,6 @@ void lua_setglobal (lua_State *L, const char *name) { | |||
170 | } | 170 | } |
171 | 171 | ||
172 | 172 | ||
173 | /* deprecated */ | ||
174 | lua_Object lua_rawgetglobal (lua_State *L, const char *name) { | ||
175 | lua_pushglobaltable(L); | ||
176 | lua_pushstring(L, name); | ||
177 | return lua_rawgettable(L); | ||
178 | } | ||
179 | |||
180 | |||
181 | /* deprecated */ | ||
182 | void lua_rawsetglobal (lua_State *L, const char *name) { | ||
183 | TObject key; | ||
184 | luaA_checkCargs(L, 1); | ||
185 | ttype(&key) = TAG_STRING; | ||
186 | tsvalue(&key) = luaS_new(L, name); | ||
187 | luaH_set(L, L->gt, &key, --L->top); | ||
188 | } | ||
189 | |||
190 | |||
191 | const char *lua_type (lua_State *L, lua_Object o) { | 173 | const char *lua_type (lua_State *L, lua_Object o) { |
192 | UNUSED(L); | 174 | UNUSED(L); |
193 | return (o == LUA_NOOBJECT) ? "NOOBJECT" : luaO_typename(o); | 175 | return (o == LUA_NOOBJECT) ? "NOOBJECT" : luaO_typename(o); |
@@ -376,3 +358,29 @@ int lua_next (lua_State *L, lua_Object t, int i) { | |||
376 | } | 358 | } |
377 | 359 | ||
378 | 360 | ||
361 | |||
362 | #if LUA_DEPRECATETFUNCS | ||
363 | |||
364 | /* | ||
365 | ** obsolete functions | ||
366 | */ | ||
367 | |||
368 | lua_Object lua_rawgetglobal (lua_State *L, const char *name) { | ||
369 | lua_pushglobaltable(L); | ||
370 | lua_pushstring(L, name); | ||
371 | return lua_rawget(L); | ||
372 | } | ||
373 | |||
374 | |||
375 | void lua_rawsetglobal (lua_State *L, const char *name) { | ||
376 | lua_Object value; | ||
377 | lua_beginblock(L); | ||
378 | value = lua_pop(L); | ||
379 | lua_pushglobaltable(L); | ||
380 | lua_pushstring(L, name); | ||
381 | lua_pushobject(L, value); | ||
382 | lua_rawset(L); | ||
383 | lua_endblock(L); | ||
384 | } | ||
385 | |||
386 | #endif | ||