diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-13 10:39:55 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-06-13 10:39:55 -0300 |
| commit | 864c96f36ce8410b03652b1cb9800e4b3c76bcf7 (patch) | |
| tree | d5061c0babf25cf222953e5195673534f8287f34 /ltable.c | |
| parent | 0052930ffe8c86f0df7ab99dd1b6668f9e10c781 (diff) | |
| download | lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.tar.gz lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.tar.bz2 lua-864c96f36ce8410b03652b1cb9800e4b3c76bcf7.zip | |
new fallback for equality `__eq'
Diffstat (limited to 'ltable.c')
| -rw-r--r-- | ltable.c | 14 |
1 files changed, 10 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 1.108 2002/05/15 18:57:44 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 1.109 2002/05/27 20:35:40 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -76,9 +76,15 @@ Node *luaH_mainposition (const Table *t, const TObject *key) { | |||
| 76 | return hashboolean(t, bvalue(key)); | 76 | return hashboolean(t, bvalue(key)); |
| 77 | case LUA_TUDATAVAL: | 77 | case LUA_TUDATAVAL: |
| 78 | return hashpointer(t, pvalue(key)); | 78 | return hashpointer(t, pvalue(key)); |
| 79 | default: /* other types are hashed as (struct *) */ | 79 | case LUA_TUSERDATA: |
| 80 | return hashpointer(t, tsvalue(key)); | 80 | return hashpointer(t, uvalue(key)); |
| 81 | case LUA_TFUNCTION: | ||
| 82 | return hashpointer(t, clvalue(key)); | ||
| 83 | case LUA_TTABLE: | ||
| 84 | return hashpointer(t, hvalue(key)); | ||
| 81 | } | 85 | } |
| 86 | lua_assert(0); | ||
| 87 | return 0; /* to avoid warnings */ | ||
| 82 | } | 88 | } |
| 83 | 89 | ||
| 84 | 90 | ||
| @@ -391,7 +397,7 @@ static const TObject *luaH_getany (Table *t, const TObject *key) { | |||
| 391 | else { | 397 | else { |
| 392 | Node *n = luaH_mainposition(t, key); | 398 | Node *n = luaH_mainposition(t, key); |
| 393 | do { /* check whether `key' is somewhere in the chain */ | 399 | do { /* check whether `key' is somewhere in the chain */ |
| 394 | if (luaO_equalObj(key(n), key)) return val(n); /* that's it */ | 400 | if (luaO_rawequalObj(key(n), key)) return val(n); /* that's it */ |
| 395 | else n = n->next; | 401 | else n = n->next; |
| 396 | } while (n); | 402 | } while (n); |
| 397 | return &luaO_nilobject; | 403 | return &luaO_nilobject; |
