I am trying to make Lua a == b call a C function. I have provided a metatable from C following the example described here:
Yet the following script (invoked from lua_pcall after pushing instances onto the stack and setting their metatables):
function testfunc(a, b)
print("Type:")
print(type(a))
print("Metatables equal?")
print(type(a) == type(b))
print(getmetatable(a) == getmetatable(b))
print(getmetatable(a)["__eq"] == getmetatable(b)["__eq"])
eqfunc = getmetatable(a)["__eq"]
print("Calling __eq directly")
print(eqfunc(a, b))
print("Calling via ==")
print(a == b)
end
i.e. the == operator does not call the C function