diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 17:05:28 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-10-25 17:05:28 -0300 |
| commit | 96e15b8501e5d8fc40c475cbac573f910ab5853b (patch) | |
| tree | 2c8efededa6849704f0db3075d0cbe0efaa40b2d /lvm.c | |
| parent | 0fd91b1b087b478fffa36f96bc0f608d86627a4b (diff) | |
| download | lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.tar.gz lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.tar.bz2 lua-96e15b8501e5d8fc40c475cbac573f910ab5853b.zip | |
threads now are real Lua objects, subject to garbage collection
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 11 |
1 files changed, 6 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.256 2002/09/19 20:12:47 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.257 2002/10/08 18:46:08 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -263,22 +263,23 @@ int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2) { | |||
| 263 | switch (ttype(t1)) { | 263 | switch (ttype(t1)) { |
| 264 | case LUA_TNIL: return 1; | 264 | case LUA_TNIL: return 1; |
| 265 | case LUA_TNUMBER: return nvalue(t1) == nvalue(t2); | 265 | case LUA_TNUMBER: return nvalue(t1) == nvalue(t2); |
| 266 | case LUA_TSTRING: return tsvalue(t1) == tsvalue(t2); | ||
| 267 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ | 266 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ |
| 268 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); | 267 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
| 269 | case LUA_TFUNCTION: return clvalue(t1) == clvalue(t2); | 268 | case LUA_TUSERDATA: { |
| 270 | case LUA_TUSERDATA: | ||
| 271 | if (uvalue(t1) == uvalue(t2)) return 1; | 269 | if (uvalue(t1) == uvalue(t2)) return 1; |
| 272 | else if ((tm = fasttm(L, uvalue(t1)->uv.metatable, TM_EQ)) == NULL && | 270 | else if ((tm = fasttm(L, uvalue(t1)->uv.metatable, TM_EQ)) == NULL && |
| 273 | (tm = fasttm(L, uvalue(t2)->uv.metatable, TM_EQ)) == NULL) | 271 | (tm = fasttm(L, uvalue(t2)->uv.metatable, TM_EQ)) == NULL) |
| 274 | return 0; /* no TM */ | 272 | return 0; /* no TM */ |
| 275 | else break; /* will try TM */ | 273 | else break; /* will try TM */ |
| 276 | case LUA_TTABLE: | 274 | } |
| 275 | case LUA_TTABLE: { | ||
| 277 | if (hvalue(t1) == hvalue(t2)) return 1; | 276 | if (hvalue(t1) == hvalue(t2)) return 1; |
| 278 | else if ((tm = fasttm(L, hvalue(t1)->metatable, TM_EQ)) == NULL && | 277 | else if ((tm = fasttm(L, hvalue(t1)->metatable, TM_EQ)) == NULL && |
| 279 | (tm = fasttm(L, hvalue(t2)->metatable, TM_EQ)) == NULL) | 278 | (tm = fasttm(L, hvalue(t2)->metatable, TM_EQ)) == NULL) |
| 280 | return 0; /* no TM */ | 279 | return 0; /* no TM */ |
| 281 | else break; /* will try TM */ | 280 | else break; /* will try TM */ |
| 281 | } | ||
| 282 | default: return gcvalue(t1) == gcvalue(t2); | ||
| 282 | } | 283 | } |
| 283 | callTMres(L, tm, t1, t2); /* call TM */ | 284 | callTMres(L, tm, t1, t2); /* call TM */ |
| 284 | return !l_isfalse(L->top); | 285 | return !l_isfalse(L->top); |
