mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 18:32:36 +00:00
Lua: String overload for effects store index.
This commit is contained in:
parent
e76ce6b696
commit
edb7081ea6
@ -240,8 +240,12 @@ namespace MWLua
|
||||
magicEffectStoreT[sol::meta_function::to_string] = [](const MagicEffectStore& store) {
|
||||
return "ESM3_MagicEffectStore{" + std::to_string(store.getSize()) + " effects}";
|
||||
};
|
||||
magicEffectStoreT[sol::meta_function::index]
|
||||
= [](const MagicEffectStore& store, int id) -> const ESM::MagicEffect* { return store.find(id); };
|
||||
magicEffectStoreT[sol::meta_function::index] = sol::overload(
|
||||
[](const MagicEffectStore& store, int id) -> const ESM::MagicEffect* { return store.find(id); },
|
||||
[](const MagicEffectStore& store, std::string_view id) -> const ESM::MagicEffect* {
|
||||
int index = ESM::MagicEffect::indexNameToIndex(id);
|
||||
return store.find(index);
|
||||
});
|
||||
auto magicEffectsIter = [magicEffectStore](sol::this_state lua, const sol::object& /*store*/,
|
||||
sol::optional<int> id) -> std::tuple<sol::object, sol::object> {
|
||||
MagicEffectStore::iterator iter;
|
||||
|
@ -663,6 +663,9 @@
|
||||
-- print(effect.name)
|
||||
-- end
|
||||
-- end
|
||||
-- @usage -- Look up the record of a specific effect and print its icon
|
||||
-- local mgef = core.magic.effects[core.magic.EFFECT_TYPE.Reflect]
|
||||
-- print('Reflect Icon: '..tostring(mgef.icon))
|
||||
|
||||
--- List of all @{#Enchantment}s.
|
||||
-- @field [parent=#Magic] #list<#Enchantment> enchantments
|
||||
|
Loading…
x
Reference in New Issue
Block a user