MCPcopy Create free account
hub / github.com/DFHack/dfhack / meta_ptr_compare

Function meta_ptr_compare

library/LuaWrapper.cpp:562–575  ·  view source on GitHub ↗

* Metamethod: compare two DF object references. * * Equal if same pointer and same metatable. */

Source from the content-addressed store, hash-verified

560 * Equal if same pointer and same metatable.
561 */
562static int meta_ptr_compare(lua_State *state)
563{
564 if (!lua_isuserdata(state, 1) || !lua_isuserdata(state, 2) ||
565 !lua_getmetatable(state, 1) || !lua_getmetatable(state, 2) ||
566 get_object_ref(state, 1) != get_object_ref(state, 2) ||
567 !is_type_compatible(state, 3, 4, true))
568 {
569 lua_pushboolean(state, false);
570 return 1;
571 }
572
573 lua_pushboolean(state, true);
574 return 1;
575}
576
577/**
578 * Method: sizeof for DF object references.

Callers

nothing calls this directly

Calls 4

lua_isuserdataFunction · 0.85
lua_getmetatableFunction · 0.85
is_type_compatibleFunction · 0.85
lua_pushbooleanFunction · 0.85

Tested by

no test coverage detected