Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m temp save, unfinished write_infobox |
m write_stat_boxes alternate_name removed |
||
| Line 167: | Line 167: | ||
local label --current stat's label | local label --current stat's label | ||
local postfix --current stat's postfix | local postfix --current stat's postfix | ||
local stat_value --current stat's numerical value in the hero data | local stat_value --current stat's numerical value in the hero data | ||
local hero_data = p.get_json_item(hero_name) | local hero_data = p.get_json_item(hero_name) | ||
| Line 189: | Line 188: | ||
for _, stat_name in ipairs(stats["_attribute_order"]) do | for _, stat_name in ipairs(stats["_attribute_order"]) do | ||
stat_data = stats[stat_name] | stat_data = stats[stat_name] | ||
-- gets the stat's value if | -- gets the stat's value if it has that stat, default to 0 if not | ||
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 203: | Line 198: | ||
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"]) | ||