diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-04 12:35:37 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-04 12:35:37 -0300 |
commit | 9319735744404831f7153653930d56826a4d2f6a (patch) | |
tree | 114f2d15772ce3e184d51ceba259a5a9c9dbecc6 /hash.c | |
parent | 1ea6e8064cdfa13ba2298783eb87de58568ea998 (diff) | |
download | lua-9319735744404831f7153653930d56826a4d2f6a.tar.gz lua-9319735744404831f7153653930d56826a4d2f6a.tar.bz2 lua-9319735744404831f7153653930d56826a4d2f6a.zip |
using new lib auxlib.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 13 |
1 files changed, 5 insertions, 8 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.38 1997/03/31 14:02:58 roberto Exp roberto $"; | 6 | char *rcs_hash="$Id: hash.c,v 2.39 1997/03/31 14:17:09 roberto Exp roberto $"; |
7 | 7 | ||
8 | 8 | ||
9 | #include "luamem.h" | 9 | #include "luamem.h" |
@@ -11,6 +11,7 @@ char *rcs_hash="$Id: hash.c,v 2.38 1997/03/31 14:02:58 roberto Exp roberto $"; | |||
11 | #include "hash.h" | 11 | #include "hash.h" |
12 | #include "table.h" | 12 | #include "table.h" |
13 | #include "lua.h" | 13 | #include "lua.h" |
14 | #include "auxlib.h" | ||
14 | 15 | ||
15 | 16 | ||
16 | #define nhash(t) ((t)->nhash) | 17 | #define nhash(t) ((t)->nhash) |
@@ -82,7 +83,7 @@ int lua_equalObj (TObject *t1, TObject *t2) | |||
82 | case LUA_T_FUNCTION: return t1->value.tf == t2->value.tf; | 83 | case LUA_T_FUNCTION: return t1->value.tf == t2->value.tf; |
83 | case LUA_T_CFUNCTION: return fvalue(t1) == fvalue(t2); | 84 | case LUA_T_CFUNCTION: return fvalue(t1) == fvalue(t2); |
84 | default: | 85 | default: |
85 | lua_error("internal error at `lua_equalObj'"); | 86 | lua_error("internal error in `lua_equalObj'"); |
86 | return 0; /* UNREACHEABLE */ | 87 | return 0; /* UNREACHEABLE */ |
87 | } | 88 | } |
88 | } | 89 | } |
@@ -301,12 +302,8 @@ void lua_next (void) | |||
301 | Hash *t; | 302 | Hash *t; |
302 | lua_Object o = lua_getparam(1); | 303 | lua_Object o = lua_getparam(1); |
303 | lua_Object r = lua_getparam(2); | 304 | lua_Object r = lua_getparam(2); |
304 | if (o == LUA_NOOBJECT || r == LUA_NOOBJECT) | 305 | luaL_arg_check(lua_istable(o), "next", 1, "table expected"); |
305 | lua_error ("too few arguments to function `next'"); | 306 | luaL_arg_check(r != LUA_NOOBJECT, "next", 2, "value expected"); |
306 | if (lua_getparam(3) != LUA_NOOBJECT) | ||
307 | lua_error ("too many arguments to function `next'"); | ||
308 | if (!lua_istable(o)) | ||
309 | lua_error ("first argument of function `next' is not a table"); | ||
310 | t = avalue(luaI_Address(o)); | 307 | t = avalue(luaI_Address(o)); |
311 | if (lua_isnil(r)) | 308 | if (lua_isnil(r)) |
312 | { | 309 | { |