MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaV_equalval

Function luaV_equalval

lua/lvm.c:294–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292
293
294int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) {
295 int res;
296 if ((res = udatacompare(L, t1, t2, TM_EQ)) != -1)
297 return res;
298 const TValue *tm;
299 lua_assert(ttype(t1) == ttype(t2));
300 switch (ttype(t1)) {
301 case LUA_TNIL: return 1;
302 case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
303 case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
304 case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
305 case LUA_TUSERDATA: {
306 if (uvalue(t1) == uvalue(t2)) return 1;
307 tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable,
308 TM_EQ);
309 break; /* will try TM */
310 }
311 case LUA_TTABLE: {
312 if (hvalue(t1) == hvalue(t2)) return 1;
313 tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
314 break; /* will try TM */
315 }
316 default: return gcvalue(t1) == gcvalue(t2);
317 }
318 if (tm == NULL) return 0; /* no TM? */
319 callTMres(L, L->top, tm, t1, t2); /* call TM */
320 return !l_isfalse(L->top);
321}
322
323
324void luaV_concat (lua_State *L, int total, int last) {

Callers

nothing calls this directly

Calls 3

udatacompareFunction · 0.85
get_compTMFunction · 0.85
callTMresFunction · 0.85

Tested by

no test coverage detected