When overriding equality operators in Lua (via the "__eq
" metamethod), is there a way to still check for primitive equality (ie. not calling the overridden __eq
, but checking if the two table values are referentially the same?) I need to do this from the C API, but I cannot find a suitable function there.
For example:
lua_newtable(L);
lua_newtable(L);
assert(!some_comparison());
lua_pushvalue(L,-1);
assert(some_comparison());
Where some_comparison()
does not invoke the __eq
metamethod.
(Please note lua_compare()
does not satisfy this, in particular. I want a lua_rawcompare()
, if you will - or rather a trick or workaround that will give me the equivalent. The idea is to prevent infinite recursion in a __eq
implementation...)