From 3e3a39539c3b5b90b20ca53beb4e9e0747b41ee7 Mon Sep 17 00:00:00 2001 From: Zackhasacat Date: Fri, 17 Nov 2023 14:51:19 -0600 Subject: [PATCH] Reorder, remove comment --- apps/openmw/mwlua/classbindings.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwlua/classbindings.cpp b/apps/openmw/mwlua/classbindings.cpp index f8290a263d..339b724f19 100644 --- a/apps/openmw/mwlua/classbindings.cpp +++ b/apps/openmw/mwlua/classbindings.cpp @@ -31,7 +31,6 @@ namespace MWLua sol::table classes(context.mLua->sol(), sol::create); addRecordFunctionBinding(classes, context); - // class record auto classT = lua.new_usertype("ESM3_Class"); classT[sol::meta_function::to_string] = [](const ESM::Class& rec) -> std::string { return "ESM3_Class[" + rec.mId.toDebugString() + "]"; }; @@ -40,16 +39,6 @@ namespace MWLua classT["description"] = sol::readonly_property([](const ESM::Class& rec) -> std::string_view { return rec.mDescription; }); - classT["majorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table { - sol::table res(lua, sol::create); - auto skills = rec.mData.mSkills; - for (size_t i = 0; i < skills.size(); ++i) - { - ESM::RefId skillId = ESM::Skill::indexToRefId(skills[i][1]); - res[i + 1] = skillId.serializeText(); - } - return res; - }); classT["attributes"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table { sol::table res(lua, sol::create); auto attribute = rec.mData.mAttribute; @@ -60,6 +49,16 @@ namespace MWLua } return res; }); + classT["majorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table { + sol::table res(lua, sol::create); + auto skills = rec.mData.mSkills; + for (size_t i = 0; i < skills.size(); ++i) + { + ESM::RefId skillId = ESM::Skill::indexToRefId(skills[i][1]); + res[i + 1] = skillId.serializeText(); + } + return res; + }); classT["minorSkills"] = sol::readonly_property([lua](const ESM::Class& rec) -> sol::table { sol::table res(lua, sol::create); auto skills = rec.mData.mSkills;