diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-07 14:34:44 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-07 14:34:44 -0200 |
commit | d95a8b312166752e2211678b33514edb1d68a0a6 (patch) | |
tree | 87a7180705c1c5e6db71831fb8cb49ce8980f4d0 /hash.c | |
parent | 9ffba7a3dbdfa68595cd8cec26bd99689ce5fd08 (diff) | |
download | lua-d95a8b312166752e2211678b33514edb1d68a0a6.tar.gz lua-d95a8b312166752e2211678b33514edb1d68a0a6.tar.bz2 lua-d95a8b312166752e2211678b33514edb1d68a0a6.zip |
new API: lua_Object now is an integer
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** hash manager for lua | 3 | ** hash manager for lua |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_hash="$Id: hash.c,v 2.12 1994/11/03 22:20:15 roberto Exp $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.13 1994/11/07 15:19:51 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <string.h> | 8 | #include <string.h> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
@@ -293,29 +293,29 @@ static void hashnext (Hash *t, int i) | |||
293 | return; | 293 | return; |
294 | } | 294 | } |
295 | } | 295 | } |
296 | lua_pushobject(ref(node(t,i))); | 296 | luaI_pushobject(ref(node(t,i))); |
297 | lua_pushobject(val(node(t,i))); | 297 | luaI_pushobject(val(node(t,i))); |
298 | } | 298 | } |
299 | 299 | ||
300 | void lua_next (void) | 300 | void lua_next (void) |
301 | { | 301 | { |
302 | Hash *t; | 302 | Hash *t; |
303 | Object *o = lua_getparam (1); | 303 | lua_Object o = lua_getparam(1); |
304 | Object *r = lua_getparam (2); | 304 | lua_Object r = lua_getparam(2); |
305 | if (o == NULL || r == NULL) | 305 | if (o == 0 || r == 0) |
306 | lua_error ("too few arguments to function `next'"); | 306 | lua_error ("too few arguments to function `next'"); |
307 | if (lua_getparam (3) != NULL) | 307 | if (lua_getparam(3) != 0) |
308 | lua_error ("too many arguments to function `next'"); | 308 | lua_error ("too many arguments to function `next'"); |
309 | if (tag(o) != LUA_T_ARRAY) | 309 | if (!lua_istable(o)) |
310 | lua_error ("first argument of function `next' is not a table"); | 310 | lua_error ("first argument of function `next' is not a table"); |
311 | t = avalue(o); | 311 | t = avalue(luaI_Address(o)); |
312 | if (tag(r) == LUA_T_NIL) | 312 | if (lua_isnil(r)) |
313 | { | 313 | { |
314 | hashnext(t, 0); | 314 | hashnext(t, 0); |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
318 | int h = present (t, r); | 318 | int h = present (t, luaI_Address(r)); |
319 | hashnext(t, h+1); | 319 | hashnext(t, h+1); |
320 | } | 320 | } |
321 | } | 321 | } |