Module:Sandbox/One Bar: Difference between revisionsGive feedback
m convert to string |
m null check |
||
| Line 48: | Line 48: | ||
for i=1,4 do | for i=1,4 do | ||
local ability = ability_data[hero_key][tostring(i)] | local ability = ability_data[hero_key][tostring(i)] | ||
hero_row:tag('td'):wikitext(ability["Name"]):done() | if (ability ~= nil) then | ||
hero_row:tag('td'):wikitext(ability["Name"]):done() | |||
local ability_text = "" | |||
-- Nowhere close to all the instances of ability spirit scaling | |||
-- probably too much nil check but I want the table to print for now | |||
if (ability["Info1"] ~= nil and ability["Info1"]["Main"] ~= nil | |||
and ability["Info1"]["Main"]["Props"] ~= nil) then | |||
for _, prop in ipairs(ability["Info1"]["Main"]["Props"]) do | |||
if (prop["Scale"] ~= nil) then | |||
ability_text = ability_text .. format_spirit_scale(frame, prop["Name"], prop["Value"], prop["Scale"]["Value"]) | |||
end | |||
end | |||
else | |||
ability_text = "-" | |||
end | end | ||
else | else | ||
hero_row:tag('td'):wikitext(""):done() | |||
end | end | ||
hero_row:tag('td'):wikitext(ability_text):done() | hero_row:tag('td'):wikitext(ability_text):done() | ||