Module:HeroData: Difference between revisions

Sur (talk | contribs)
m only dps in infobox made brown
Sur (talk | contribs)
m get_lore replaced with get_localized_var
Line 43: Line 43:




--{{#invoke:HeroData|get_lore|HERO_NAME}}--
--{{#invoke:HeroData|get_localized_var|HERO_NAME|HERO_VAR}}--
p.get_lore = function(frame)
--i.e. |Abrams|Role -> hero_atlas_role -> Charges into close combat
p.get_localized_var = function(frame)
local hero_name = frame.args[1]
local hero_name = frame.args[1]
lore_key = p.get_json_item(hero_name)['Lore']
local unlocalized_var = frame.args[2]
lore_key = p.get_json_item(hero_name)[unlocalized_var]
if (lore_key ~= nil) then
if (lore_key ~= nil) then
return lang_module._get_string(lore_key)
return lang_module._get_string(lore_key)
else
else
return "Hero does not have Lore written"
return "Hero does not have " .. unlocalized_var .. " in their data"
end
end
end
end