commit 44a53df688082b9c213bdbeb28acc87c025edeb9
parent 63a822c8e199918c54e325cbc8696ed04071aba8
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 30 Jan 2001 17:48:15 -0200
better to avoid dirty tricks
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/ltable.c b/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 1.72 2001/01/29 17:16:58 roberto Exp roberto $
+** $Id: ltable.c,v 1.73 2001/01/29 19:34:02 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -203,7 +203,7 @@ TObject *luaH_setnum (lua_State *L, Hash *t, lua_Number key) {
Node *mp = hashnum(t, key);
Node *n = mp;
do { /* check whether `key' is somewhere in the chain */
- if (nvalue_key(n) == key && ttype_key(n) == LUA_TNUMBER)
+ if (ttype_key(n) == LUA_TNUMBER && nvalue_key(n) == key)
return &n->val; /* that's all */
else n = n->next;
} while (n);
@@ -222,7 +222,7 @@ TObject *luaH_setstr (lua_State *L, Hash *t, TString *key) {
Node *mp = hashstr(t, key);
Node *n = mp;
do { /* check whether `key' is somewhere in the chain */
- if (tsvalue_key(n) == key && ttype_key(n) == LUA_TSTRING)
+ if (ttype_key(n) == LUA_TSTRING && tsvalue_key(n) == key)
return &n->val; /* that's all */
else n = n->next;
} while (n);
@@ -241,7 +241,7 @@ static TObject *luaH_setany (lua_State *L, Hash *t, const TObject *key) {
Node *n = mp;
do { /* check whether `key' is somewhere in the chain */
/* compare as `tsvalue', but may be other pointers (it is the same) */
- if (tsvalue_key(n) == tsvalue(key) && ttype_key(n) == ttype(key))
+ if (ttype_key(n) == ttype(key) && tsvalue_key(n) == tsvalue(key))
return &n->val; /* that's all */
else n = n->next;
} while (n);