MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaV_equalobj_

Function luaV_equalobj_

freebsd/contrib/openzfs/module/lua/lvm.c:261–291  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

luaS_eqlngstrFunction · 0.85
get_equalTMFunction · 0.85
callTMFunction · 0.70

Tested by

no test coverage detected