1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-05-28 10:41:31 +00:00

Avoid reference to temporary in levelled creatures bindings (#8347)

This commit is contained in:
Alexei Kotov 2025-02-10 12:49:14 +03:00
parent 1aa4ef029c
commit 5626d925e3

View file

@ -43,7 +43,7 @@ namespace MWLua
[](const ESM::CreatureLevList& rec) -> std::string { return rec.mId.serializeText(); });
record["chanceNone"] = sol::readonly_property(
[](const ESM::CreatureLevList& rec) -> float { return std::clamp(rec.mChanceNone / 100.f, 0.f, 1.f); });
record["creatures"] = sol::readonly_property([&](const ESM::CreatureLevList& rec) -> sol::table {
record["creatures"] = sol::readonly_property([state](const ESM::CreatureLevList& rec) -> sol::table {
sol::table res(state, sol::create);
for (size_t i = 0; i < rec.mList.size(); ++i)
res[LuaUtil::toLuaIndex(i)] = rec.mList[i];