MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaV_equalval

Function luaV_equalval

other_src/lua/src/lvm.cpp:257–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

get_compTMFunction · 0.70
callTMresFunction · 0.70

Tested by

no test coverage detected