Module:Abilities: Difference between revisions

No edit summary
Tags: Mobile edit Mobile web edit
m Optimised search by ability name
Line 24: Line 24:
end
end
-- If not found by key, loop through and search by the "Name" property as a fallback
-- If not found by key, search for key by ability name
for _, v in pairs(raw_ability_data) do
local resource_lookup = mw.loadJsonData("Data:ResourceLookup.json")
if (v["Name"] == identifier) then
local ability_resource = resource_lookup[identifier]
return v
end
if (ability_resource) then
return raw_ability_data[ability_resource.key]
end
end
 
-- If not found by either method, return nil
-- If not found by either method, return nil
return nil
return nil