MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaV_equalobj_

Function luaV_equalobj_

third-party/lua-5.2.4/src/lvm.c:260–290  ·  view source on GitHub ↗

** equality of Lua values. L == NULL means raw equality (no metamethods) */

Source from the content-addressed store, hash-verified

258** equality of Lua values. L == NULL means raw equality (no metamethods)
259*/
260int luaV_equalobj_ (lua_State *L, const TValue *t1, const TValue *t2) {
261 const TValue *tm;
262 lua_assert(ttisequal(t1, t2));
263 switch (ttype(t1)) {
264 case LUA_TNIL: return 1;
265 case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2));
266 case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
267 case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
268 case LUA_TLCF: return fvalue(t1) == fvalue(t2);
269 case LUA_TSHRSTR: return eqshrstr(rawtsvalue(t1), rawtsvalue(t2));
270 case LUA_TLNGSTR: return luaS_eqlngstr(rawtsvalue(t1), rawtsvalue(t2));
271 case LUA_TUSERDATA: {
272 if (uvalue(t1) == uvalue(t2)) return 1;
273 else if (L == NULL) return 0;
274 tm = get_equalTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, TM_EQ);
275 break; /* will try TM */
276 }
277 case LUA_TTABLE: {
278 if (hvalue(t1) == hvalue(t2)) return 1;
279 else if (L == NULL) return 0;
280 tm = get_equalTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ);
281 break; /* will try TM */
282 }
283 default:
284 lua_assert(iscollectable(t1));
285 return gcvalue(t1) == gcvalue(t2);
286 }
287 if (tm == NULL) return 0; /* no TM? */
288 callTM(L, tm, t1, t2, L->top, 1); /* call TM */
289 return !l_isfalse(L->top);
290}
291
292
293void luaV_concat (lua_State *L, int total) {

Callers

nothing calls this directly

Calls 3

get_equalTMFunction · 0.85
luaS_eqlngstrFunction · 0.70
callTMFunction · 0.70

Tested by

no test coverage detected