1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-11-01 19:56:38 +00:00

Return type as a sol::object instead of a table proxy

This commit is contained in:
Evil Eye 2025-10-23 20:51:01 +02:00
parent 2e67c8b47f
commit 823dc6a896

View file

@ -330,10 +330,9 @@ namespace MWLua
return LuaUtil::Box{ bb.center(), bb._max - bb.center() }; return LuaUtil::Box{ bb.center(), bb._max - bb.center() };
}; };
objectT["type"] objectT["type"] = sol::readonly_property(
= sol::readonly_property([types = getTypeToPackageTable(context.sol())](const ObjectT& o) mutable { [types = getTypeToPackageTable(context.sol())](
return types[getLiveCellRefType(o.ptr().mRef)]; const ObjectT& o) -> sol::object { return types[getLiveCellRefType(o.ptr().mRef)]; });
});
objectT["count"] = sol::readonly_property([](const ObjectT& o) { return o.ptr().getCellRef().getCount(); }); objectT["count"] = sol::readonly_property([](const ObjectT& o) { return o.ptr().getCellRef().getCount(); });
objectT[sol::meta_function::equal_to] = [](const ObjectT& a, const ObjectT& b) { return a.id() == b.id(); }; objectT[sol::meta_function::equal_to] = [](const ObjectT& a, const ObjectT& b) { return a.id() == b.id(); };