MCPcopy Create free account
hub / github.com/defold/defold / luaV_equalval

Function luaV_equalval

engine/lua/src/lua/lvm.c:251–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

get_compTMFunction · 0.85
callTMresFunction · 0.85

Tested by

no test coverage detected