Module:HeroData: Difference between revisions

Sur (talk | contribs)
m get_list_elem also allows key being passed
Sur (talk | contribs)
m write_default_items now uses unlocalized
Line 94: Line 94:


p.write_default_items = function(frame)
p.write_default_items = function(frame)
local hero_name = frame.args[1] --english
local hero_key = frame.args[1] --unlocalized
if (hero_name == nil) then return "No hero name provided" end
if (hero_key == nil) then return "No hero key provided" end
local str = ""
local str = ""
local hero = heroes_data[p.get_hero_key(hero_name)]
local hero = heroes_data[hero_key]
if (hero == nil) then return "Hero not found, must be in english" end
if (hero == nil) then return "Hero not found, must be unlocalized" end
local template_title = 'PageRef'
local template_title = 'PageRef'
for i, item_key in ipairs(hero["RecommendedItems"]) do
for i, item_key in ipairs(hero["RecommendedItems"]) do