mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-04 12:39:55 +00:00
Use ESM::RefId::toDebugString to convert record to string in Lua
This commit is contained in:
parent
30fd8c9d23
commit
33a59a9342
@ -83,7 +83,7 @@ namespace MWLua
|
||||
|
||||
sol::usertype<LocalMWScript> mwscript = context.mLua->sol().new_usertype<LocalMWScript>("LocalMWScript");
|
||||
mwscript[sol::meta_function::to_string] = [](const LocalMWScript& s) {
|
||||
return s.mSelf.ptr().getRefData().getLocals().getScriptId().getRefIdString();
|
||||
return s.mSelf.ptr().getRefData().getLocals().getScriptId().toDebugString();
|
||||
};
|
||||
mwscript[sol::meta_function::index] = [](const LocalMWScript& s, std::string_view var) {
|
||||
MWScript::Locals& locals = s.mSelf.ptr().getRefData().getLocals();
|
||||
@ -92,8 +92,8 @@ namespace MWLua
|
||||
mwscript[sol::meta_function::new_index] = [](const LocalMWScript& s, std::string_view var, double val) {
|
||||
MWScript::Locals& locals = s.mSelf.ptr().getRefData().getLocals();
|
||||
if (!locals.setVar(locals.getScriptId(), Misc::StringUtils::lowerCase(var), val))
|
||||
throw std::runtime_error("No variable \"" + std::string(var) + "\" in mwscript \""
|
||||
+ locals.getScriptId().getRefIdString() + "\"");
|
||||
throw std::runtime_error(
|
||||
"No variable \"" + std::string(var) + "\" in mwscript " + locals.getScriptId().toDebugString());
|
||||
};
|
||||
|
||||
using AiPackage = MWMechanics::AiPackage;
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Activator> record = context.mLua->sol().new_usertype<ESM::Activator>("ESM3_Activator");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Activator& rec) { return "ESM3_Activator[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Activator& rec) { return "ESM3_Activator[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Activator& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Activator& rec) -> std::string { return rec.mName; });
|
||||
|
@ -39,7 +39,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Apparatus> record = context.mLua->sol().new_usertype<ESM::Apparatus>("ESM3_Apparatus");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Apparatus& rec) { return "ESM3_Apparatus[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Apparatus& rec) { return "ESM3_Apparatus[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Apparatus& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Apparatus& rec) -> std::string { return rec.mName; });
|
||||
|
@ -45,7 +45,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Armor> record = context.mLua->sol().new_usertype<ESM::Armor>("ESM3_Armor");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Armor& rec) -> std::string { return "ESM3_Armor[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Armor& rec) -> std::string { return "ESM3_Armor[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mName; });
|
||||
|
@ -40,7 +40,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Book> record = context.mLua->sol().new_usertype<ESM::Book>("ESM3_Book");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Book& rec) { return "ESM3_Book[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Book& rec) { return "ESM3_Book[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mName; });
|
||||
|
@ -45,7 +45,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Clothing> record = context.mLua->sol().new_usertype<ESM::Clothing>("ESM3_Clothing");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Clothing& rec) -> std::string { return "ESM3_Clothing[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Clothing& rec) -> std::string { return "ESM3_Clothing[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Clothing& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Clothing& rec) -> std::string { return rec.mName; });
|
||||
|
@ -57,7 +57,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Container> record = context.mLua->sol().new_usertype<ESM::Container>("ESM3_Container");
|
||||
record[sol::meta_function::to_string] = [](const ESM::Container& rec) -> std::string {
|
||||
return "ESM3_Container[" + rec.mId.getRefIdString() + "]";
|
||||
return "ESM3_Container[" + rec.mId.toDebugString() + "]";
|
||||
};
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Container& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Creature> record = context.mLua->sol().new_usertype<ESM::Creature>("ESM3_Creature");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Creature& rec) { return "ESM3_Creature[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Creature& rec) { return "ESM3_Creature[" + rec.mId.toDebugString() + "]"; };
|
||||
record["name"] = sol::readonly_property([](const ESM::Creature& rec) -> std::string { return rec.mName; });
|
||||
record["model"] = sol::readonly_property([vfs](const ESM::Creature& rec) -> std::string {
|
||||
return Misc::ResourceHelpers::correctMeshPath(rec.mModel, vfs);
|
||||
|
@ -52,7 +52,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Door> record = context.mLua->sol().new_usertype<ESM::Door>("ESM3_Door");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Door& rec) -> std::string { return "ESM3_Door[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Door& rec) -> std::string { return "ESM3_Door[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Door& rec) -> std::string { return rec.mName; });
|
||||
|
@ -33,7 +33,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Ingredient> record = context.mLua->sol().new_usertype<ESM::Ingredient>(("ESM3_Ingredient"));
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Ingredient& rec) { return "ESM3_Ingredient[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Ingredient& rec) { return "ESM3_Ingredient[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"] = sol::readonly_property(
|
||||
[](const ESM::Ingredient& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Ingredient& rec) -> std::string { return rec.mName; });
|
||||
|
@ -31,7 +31,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Light> record = context.mLua->sol().new_usertype<ESM::Light>("ESM3_Light");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Light& rec) -> std::string { return "ESM3_Light[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Light& rec) -> std::string { return "ESM3_Light[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Light& rec) -> std::string { return rec.mName; });
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Lockpick> record = context.mLua->sol().new_usertype<ESM::Lockpick>("ESM3_Lockpick");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Lockpick& rec) { return "ESM3_Lockpick[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Lockpick& rec) { return "ESM3_Lockpick[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Lockpick& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Lockpick& rec) -> std::string { return rec.mName; });
|
||||
|
@ -33,7 +33,7 @@ namespace MWLua
|
||||
sol::usertype<ESM::Miscellaneous> record
|
||||
= context.mLua->sol().new_usertype<ESM::Miscellaneous>("ESM3_Miscellaneous");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Miscellaneous& rec) { return "ESM3_Miscellaneous[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Miscellaneous& rec) { return "ESM3_Miscellaneous[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"] = sol::readonly_property(
|
||||
[](const ESM::Miscellaneous& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Miscellaneous& rec) -> std::string { return rec.mName; });
|
||||
|
@ -33,7 +33,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::NPC> record = context.mLua->sol().new_usertype<ESM::NPC>("ESM3_NPC");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::NPC& rec) { return "ESM3_NPC[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::NPC& rec) { return "ESM3_NPC[" + rec.mId.toDebugString() + "]"; };
|
||||
record["name"] = sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mName; });
|
||||
record["race"]
|
||||
= sol::readonly_property([](const ESM::NPC& rec) -> std::string { return rec.mRace.getRefIdString(); });
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
auto vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
|
||||
sol::usertype<ESM::Potion> record = context.mLua->sol().new_usertype<ESM::Potion>("ESM3_Potion");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Potion& rec) { return "ESM3_Potion[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Potion& rec) { return "ESM3_Potion[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Potion& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Potion& rec) -> std::string { return rec.mName; });
|
||||
|
@ -31,7 +31,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Probe> record = context.mLua->sol().new_usertype<ESM::Probe>("ESM3_Probe");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Probe& rec) { return "ESM3_Probe[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Probe& rec) { return "ESM3_Probe[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Probe& rec) -> std::string { return rec.mName; });
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Repair> record = context.mLua->sol().new_usertype<ESM::Repair>("ESM3_Repair");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Repair& rec) { return "ESM3_Repair[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Repair& rec) { return "ESM3_Repair[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Repair& rec) -> std::string { return rec.mName; });
|
||||
|
@ -32,7 +32,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Static> record = context.mLua->sol().new_usertype<ESM::Static>("ESM3_Static");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Static& rec) -> std::string { return "ESM3_Static[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Static& rec) -> std::string { return "ESM3_Static[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Static& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["model"] = sol::readonly_property([vfs](const ESM::Static& rec) -> std::string {
|
||||
|
@ -49,7 +49,7 @@ namespace MWLua
|
||||
});
|
||||
sol::usertype<ESM::Weapon> record = context.mLua->sol().new_usertype<ESM::Weapon>("ESM3_Weapon");
|
||||
record[sol::meta_function::to_string]
|
||||
= [](const ESM::Weapon& rec) -> std::string { return "ESM3_Weapon[" + rec.mId.getRefIdString() + "]"; };
|
||||
= [](const ESM::Weapon& rec) -> std::string { return "ESM3_Weapon[" + rec.mId.toDebugString() + "]"; };
|
||||
record["id"]
|
||||
= sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mId.getRefIdString(); });
|
||||
record["name"] = sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mName; });
|
||||
|
Loading…
x
Reference in New Issue
Block a user