Editing Module:Abilities/utilsGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 6: | Line 6: | ||
local data = mw.loadJsonData("Data:AbilityCards.json") | local data = mw.loadJsonData("Data:AbilityCards.json") | ||
-- returns the table of a specific item | -- returns the table of a specific item | ||
function p.get_ability_card_data( | function p.get_ability_card_data(hero_name, ability_num) | ||
local hero_key = get_hero_key(hero_name) | |||
if(hero_key == nil) then return nil end | if(hero_key == nil) then return nil end | ||
return data[hero_key][tonumber(ability_num)] | return data[hero_key][tonumber(ability_num)] | ||
end | end | ||
function | function get_hero_key(hero_name) | ||
for i, hero in pairs(data) do | for i, hero in pairs(data) do | ||
if hero["Name"] == hero_name then | if hero["Name"] == hero_name then | ||