From 9319735744404831f7153653930d56826a4d2f6a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 4 Apr 1997 12:35:37 -0300 Subject: using new lib auxlib. --- hash.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index 801bf971..dcf3992a 100644 --- a/hash.c +++ b/hash.c @@ -3,7 +3,7 @@ ** hash manager for lua */ -char *rcs_hash="$Id: hash.c,v 2.38 1997/03/31 14:02:58 roberto Exp roberto $"; +char *rcs_hash="$Id: hash.c,v 2.39 1997/03/31 14:17:09 roberto Exp roberto $"; #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 $"; #include "hash.h" #include "table.h" #include "lua.h" +#include "auxlib.h" #define nhash(t) ((t)->nhash) @@ -82,7 +83,7 @@ int lua_equalObj (TObject *t1, TObject *t2) case LUA_T_FUNCTION: return t1->value.tf == t2->value.tf; case LUA_T_CFUNCTION: return fvalue(t1) == fvalue(t2); default: - lua_error("internal error at `lua_equalObj'"); + lua_error("internal error in `lua_equalObj'"); return 0; /* UNREACHEABLE */ } } @@ -301,12 +302,8 @@ void lua_next (void) Hash *t; lua_Object o = lua_getparam(1); lua_Object r = lua_getparam(2); - if (o == LUA_NOOBJECT || r == LUA_NOOBJECT) - lua_error ("too few arguments to function `next'"); - if (lua_getparam(3) != LUA_NOOBJECT) - lua_error ("too many arguments to function `next'"); - if (!lua_istable(o)) - lua_error ("first argument of function `next' is not a table"); + luaL_arg_check(lua_istable(o), "next", 1, "table expected"); + luaL_arg_check(r != LUA_NOOBJECT, "next", 2, "value expected"); t = avalue(luaI_Address(o)); if (lua_isnil(r)) { -- cgit v1.2.3-55-g6feb