| 253 | |
| 254 | |
| 255 | int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { |
| 256 | const TValue *tm; |
| 257 | lua_assert(ttype(t1) == ttype(t2)); |
| 258 | switch (ttype(t1)) { |
| 259 | case LUA_TNIL: return 1; |
| 260 | case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); |
| 261 | case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ |
| 262 | case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); |
| 263 | case LUA_TUSERDATA: { |
| 264 | if (uvalue(t1) == uvalue(t2)) return 1; |
| 265 | tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, |
| 266 | TM_EQ); |
| 267 | break; /* will try TM */ |
| 268 | } |
| 269 | case LUA_TTABLE: { |
| 270 | if (hvalue(t1) == hvalue(t2)) return 1; |
| 271 | tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); |
| 272 | break; /* will try TM */ |
| 273 | } |
| 274 | default: return gcvalue(t1) == gcvalue(t2); |
| 275 | } |
| 276 | if (tm == NULL) return 0; /* no TM? */ |
| 277 | callTMres(L, L->top, tm, t1, t2); /* call TM */ |
| 278 | return !l_isfalse(L->top); |
| 279 | } |
| 280 | |
| 281 | |
| 282 | void luaV_concat (lua_State *L, int total, int last) { |
nothing calls this directly
no test coverage detected