MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / equalkey

Function equalkey

lib/lua/src/ltable.c:216–236  ·  view source on GitHub ↗

** Check whether key 'k1' is equal to the key in node 'n2'. This ** equality is raw, so there are no metamethods. Floats with integer ** values have been normalized, so integers cannot be equal to ** floats. It is assumed that 'eqshrstr' is simply pointer equality, so ** that short strings are handled in the default case. ** A true 'deadok' means to accept dead keys as equal to their original ** v

Source from the content-addressed store, hash-verified

214** some other valid item on the table or nil.)
215*/
216static int equalkey (const TValue *k1, const Node *n2, int deadok) {
217 if ((rawtt(k1) != keytt(n2)) && /* not the same variants? */
218 !(deadok && keyisdead(n2) && iscollectable(k1)))
219 return 0; /* cannot be same key */
220 switch (keytt(n2)) {
221 case LUA_VNIL: case LUA_VFALSE: case LUA_VTRUE:
222 return 1;
223 case LUA_VNUMINT:
224 return (ivalue(k1) == keyival(n2));
225 case LUA_VNUMFLT:
226 return luai_numeq(fltvalue(k1), fltvalueraw(keyval(n2)));
227 case LUA_VLIGHTUSERDATA:
228 return pvalue(k1) == pvalueraw(keyval(n2));
229 case LUA_VLCF:
230 return fvalue(k1) == fvalueraw(keyval(n2));
231 case ctb(LUA_VLNGSTR):
232 return luaS_eqlngstr(tsvalue(k1), keystrval(n2));
233 default:
234 return gcvalue(k1) == gcvalueraw(keyval(n2));
235 }
236}
237
238
239/*

Callers 1

getgenericFunction · 0.85

Calls 1

luaS_eqlngstrFunction · 0.85

Tested by

no test coverage detected