Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m write_stat_boxes alternate_name removed |
m temp save, unfinished write_infobox |
||
| Line 94: | Line 94: | ||
local stats | local stats | ||
local stat_data | local stat_data | ||
local stat_value | local stat_value | ||
local stat_text | |||
local label | local label | ||
local postfix | local postfix | ||
| Line 109: | Line 109: | ||
for _, stat_name in ipairs(infobox_attributes[category]) do | for _, stat_name in ipairs(infobox_attributes[category]) do | ||
stat_data = stats[stat_name] | stat_data = stats[stat_name] | ||
-- gets the stat's value | -- gets the stat's value | ||
stat_value = hero_data[ | stat_value = hero_data[stat_name] | ||
if (stat_value == nil) then | if (stat_value == nil) then | ||
stat_value = 0 --default to 0 if not present | |||
end | end | ||
| Line 123: | Line 119: | ||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | stat_value = util_module.round_to_sig_fig(stat_value, 3) | ||
-- get label and postfix | -- get label and postfix | ||
label = util_module.call_lang(stat_data["label"]) | label = util_module.call_lang(stat_data["label"]) | ||
| Line 132: | Line 127: | ||
postfix = util_module.call_lang(postfix) | postfix = util_module.call_lang(postfix) | ||
end | end | ||
end | end | ||
else | |||
return "Error: Category not in attributes data" | |||
end | end | ||