mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-05 15:40:10 +00:00
dont return empty string for absent value
This commit is contained in:
parent
3ebeaaa3bb
commit
bf9f5dc2ef
@ -98,8 +98,11 @@ namespace MWLua
|
||||
record["icon"] = sol::readonly_property([vfs](const ESM::Armor& rec) -> std::string {
|
||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||
});
|
||||
record["enchant"]
|
||||
= sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mEnchant.serializeText(); });
|
||||
record["enchant"] = sol::readonly_property([](const ESM::Armor& rec) -> sol::optional<std::string> {
|
||||
if (rec.mEnchant.empty())
|
||||
return sol::nullopt;
|
||||
return rec.mEnchant.serializeText();
|
||||
});
|
||||
record["mwscript"]
|
||||
= sol::readonly_property([](const ESM::Armor& rec) -> std::string { return rec.mScript.serializeText(); });
|
||||
record["weight"] = sol::readonly_property([](const ESM::Armor& rec) -> float { return rec.mData.mWeight; });
|
||||
|
@ -110,8 +110,11 @@ namespace MWLua
|
||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||
});
|
||||
record["text"] = sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mText; });
|
||||
record["enchant"]
|
||||
= sol::readonly_property([](const ESM::Book& rec) -> std::string { return rec.mEnchant.serializeText(); });
|
||||
record["enchant"] = sol::readonly_property([](const ESM::Book& rec) -> sol::optional<std::string> {
|
||||
if (rec.mEnchant.empty())
|
||||
return sol::nullopt;
|
||||
return rec.mEnchant.serializeText();
|
||||
});
|
||||
record["isScroll"] = sol::readonly_property([](const ESM::Book& rec) -> bool { return rec.mData.mIsScroll; });
|
||||
record["value"] = sol::readonly_property([](const ESM::Book& rec) -> int { return rec.mData.mValue; });
|
||||
record["weight"] = sol::readonly_property([](const ESM::Book& rec) -> float { return rec.mData.mWeight; });
|
||||
|
@ -93,8 +93,11 @@ namespace MWLua
|
||||
record["icon"] = sol::readonly_property([vfs](const ESM::Clothing& rec) -> std::string {
|
||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||
});
|
||||
record["enchant"] = sol::readonly_property(
|
||||
[](const ESM::Clothing& rec) -> std::string { return rec.mEnchant.serializeText(); });
|
||||
record["enchant"] = sol::readonly_property([](const ESM::Clothing& rec) -> sol::optional<std::string> {
|
||||
if (rec.mEnchant.empty())
|
||||
return sol::nullopt;
|
||||
return rec.mEnchant.serializeText();
|
||||
});
|
||||
record["mwscript"] = sol::readonly_property(
|
||||
[](const ESM::Clothing& rec) -> std::string { return rec.mScript.serializeText(); });
|
||||
record["weight"] = sol::readonly_property([](const ESM::Clothing& rec) -> float { return rec.mData.mWeight; });
|
||||
|
@ -131,8 +131,11 @@ namespace MWLua
|
||||
record["icon"] = sol::readonly_property([vfs](const ESM::Weapon& rec) -> std::string {
|
||||
return Misc::ResourceHelpers::correctIconPath(rec.mIcon, vfs);
|
||||
});
|
||||
record["enchant"] = sol::readonly_property(
|
||||
[](const ESM::Weapon& rec) -> std::string { return rec.mEnchant.serializeText(); });
|
||||
record["enchant"] = sol::readonly_property([](const ESM::Weapon& rec) -> sol::optional<std::string> {
|
||||
if (rec.mEnchant.empty())
|
||||
return sol::nullopt;
|
||||
return rec.mEnchant.serializeText();
|
||||
});
|
||||
record["mwscript"]
|
||||
= sol::readonly_property([](const ESM::Weapon& rec) -> std::string { return rec.mScript.serializeText(); });
|
||||
record["isMagical"] = sol::readonly_property(
|
||||
|
@ -1327,7 +1327,7 @@
|
||||
-- @field #string model VFS path to the model
|
||||
-- @field #string mwscript MWScript on this armor (can be empty)
|
||||
-- @field #string icon VFS path to the icon
|
||||
-- @field #string enchant The enchantment ID of this armor (can be empty)
|
||||
-- @field #string enchant The enchantment ID of this armor (can be nil)
|
||||
-- @field #number weight
|
||||
-- @field #number value
|
||||
-- @field #number type See @{#Armor.TYPE}
|
||||
@ -1416,7 +1416,7 @@
|
||||
-- @field #string model VFS path to the model
|
||||
-- @field #string mwscript MWScript on this book (can be empty)
|
||||
-- @field #string icon VFS path to the icon
|
||||
-- @field #string enchant The enchantment ID of this book (can be empty)
|
||||
-- @field #string enchant The enchantment ID of this book (can be nil)
|
||||
-- @field #string text The text content of the book
|
||||
-- @field #number weight
|
||||
-- @field #number value
|
||||
@ -1494,7 +1494,7 @@
|
||||
-- @field #string model VFS path to the model
|
||||
-- @field #string mwscript MWScript on this clothing (can be empty)
|
||||
-- @field #string icon VFS path to the icon
|
||||
-- @field #string enchant The enchantment ID of this clothing (can be empty)
|
||||
-- @field #string enchant The enchantment ID of this clothing (can be nil)
|
||||
-- @field #number weight
|
||||
-- @field #number value
|
||||
-- @field #number type See @{#Clothing.TYPE}
|
||||
@ -1819,7 +1819,7 @@
|
||||
-- @field #string model VFS path to the model
|
||||
-- @field #string mwscript MWScript on this weapon (can be empty)
|
||||
-- @field #string icon VFS path to the icon
|
||||
-- @field #string enchant
|
||||
-- @field #string enchant The enchantment ID of this weapon (can be nil)
|
||||
-- @field #boolean isMagical
|
||||
-- @field #boolean isSilver
|
||||
-- @field #number weight
|
||||
|
Loading…
x
Reference in New Issue
Block a user