diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-09-02 16:54:49 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-09-02 16:54:49 -0300 |
| commit | 4964e7c8a0284a75a57cf591c3b3c77febaf40e6 (patch) | |
| tree | d47c75cc6c36b87b8c837fe9487161c375d76d1c /lobject.c | |
| parent | 2c670baf24115d9c59b5869b89873b93af8b779d (diff) | |
| download | lua-4964e7c8a0284a75a57cf591c3b3c77febaf40e6.tar.gz lua-4964e7c8a0284a75a57cf591c3b3c77febaf40e6.tar.bz2 lua-4964e7c8a0284a75a57cf591c3b3c77febaf40e6.zip | |
details
Diffstat (limited to 'lobject.c')
| -rw-r--r-- | lobject.c | 18 |
1 files changed, 5 insertions, 13 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lobject.c,v 1.85 2002/07/17 16:25:13 roberto Exp roberto $ | 2 | ** $Id: lobject.c,v 1.86 2002/08/07 14:35:55 roberto Exp roberto $ |
| 3 | ** Some generic functions over Lua objects | 3 | ** Some generic functions over Lua objects |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -58,25 +58,17 @@ int luaO_log2 (unsigned int x) { | |||
| 58 | int luaO_rawequalObj (const TObject *t1, const TObject *t2) { | 58 | int luaO_rawequalObj (const TObject *t1, const TObject *t2) { |
| 59 | if (ttype(t1) != ttype(t2)) return 0; | 59 | if (ttype(t1) != ttype(t2)) return 0; |
| 60 | switch (ttype(t1)) { | 60 | switch (ttype(t1)) { |
| 61 | case LUA_TNUMBER: | ||
| 62 | return nvalue(t1) == nvalue(t2); | ||
| 63 | case LUA_TNIL: | 61 | case LUA_TNIL: |
| 64 | return 1; | 62 | return 1; |
| 65 | case LUA_TSTRING: | ||
| 66 | return tsvalue(t1) == tsvalue(t2); | ||
| 67 | case LUA_TBOOLEAN: | 63 | case LUA_TBOOLEAN: |
| 68 | return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ | 64 | return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ |
| 69 | case LUA_TLIGHTUSERDATA: | 65 | case LUA_TLIGHTUSERDATA: |
| 70 | return pvalue(t1) == pvalue(t2); | 66 | return pvalue(t1) == pvalue(t2); |
| 71 | case LUA_TUSERDATA: | 67 | case LUA_TNUMBER: |
| 72 | return uvalue(t1) == uvalue(t2); | 68 | return nvalue(t1) == nvalue(t2); |
| 73 | case LUA_TTABLE: | 69 | default: |
| 74 | return hvalue(t1) == hvalue(t2); | 70 | return gcvalue(t1) == gcvalue(t2); |
| 75 | case LUA_TFUNCTION: | ||
| 76 | return clvalue(t1) == clvalue(t2); | ||
| 77 | } | 71 | } |
| 78 | lua_assert(0); | ||
| 79 | return 0; /* to avoid warnings */ | ||
| 80 | } | 72 | } |
| 81 | 73 | ||
| 82 | 74 | ||
