| 288 | } |
| 289 | |
| 290 | LUA_API int lua_equal(lua_State *L, int idx1, int idx2) |
| 291 | { |
| 292 | cTValue *o1 = index2adr(L, idx1); |
| 293 | cTValue *o2 = index2adr(L, idx2); |
| 294 | if (tvisint(o1) && tvisint(o2)) { |
| 295 | return intV(o1) == intV(o2); |
| 296 | } else if (tvisnumber(o1) && tvisnumber(o2)) { |
| 297 | return numberVnum(o1) == numberVnum(o2); |
| 298 | } else if (itype(o1) != itype(o2)) { |
| 299 | return 0; |
| 300 | } else if (tvispri(o1)) { |
| 301 | return o1 != niltv(L) && o2 != niltv(L); |
| 302 | #if LJ_64 && !LJ_GC64 |
| 303 | } else if (tvislightud(o1)) { |
| 304 | return o1->u64 == o2->u64; |
| 305 | #endif |
| 306 | } else if (gcrefeq(o1->gcr, o2->gcr)) { |
| 307 | return 1; |
| 308 | } else if (!tvistabud(o1)) { |
| 309 | return 0; |
| 310 | } else { |
| 311 | TValue *base = lj_meta_equal(L, gcV(o1), gcV(o2), 0); |
| 312 | if ((uintptr_t)base <= 1) { |
| 313 | return (int)(uintptr_t)base; |
| 314 | } else { |
| 315 | L->top = base+2; |
| 316 | lj_vm_call(L, base, 1+1); |
| 317 | L->top -= 2+LJ_FR2; |
| 318 | return tvistruecond(L->top+1+LJ_FR2); |
| 319 | } |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | LUA_API int lua_lessthan(lua_State *L, int idx1, int idx2) |
| 324 | { |
no test coverage detected