1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-10-31 20:26:43 +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() };
};
objectT["type"]
= sol::readonly_property([types = getTypeToPackageTable(context.sol())](const ObjectT& o) mutable {
return types[getLiveCellRefType(o.ptr().mRef)];
});
objectT["type"] = sol::readonly_property(
[types = getTypeToPackageTable(context.sol())](
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[sol::meta_function::equal_to] = [](const ObjectT& a, const ObjectT& b) { return a.id() == b.id(); };