Editing Module:Abilities/details tableGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 2: | Line 2: | ||
local utils = require "Module:Abilities/utils" | local utils = require "Module:Abilities/utils" | ||
local header_attrs = {'Radius', 'AbilityCastRange', 'AbilityDuration', 'AbilityCooldown', 'AbilityCooldownBetweenCharge', 'AbilityCharges'} | local header_attrs = {'Radius', 'AbilityCastRange', 'AbilityDuration', 'AbilityCooldown', 'AbilityCooldownBetweenCharge', 'AbilityCharges'} | ||
| Line 10: | Line 8: | ||
local hero_name = frame.args[1] | local hero_name = frame.args[1] | ||
local ability_num = frame.args[2] | local ability_num = frame.args[2] | ||
local ability = utils.get_ability_card_data(hero_name, ability_num) | |||
local ability = utils.get_ability_card_data( | |||
if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | ||
| Line 26: | Line 23: | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value | rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 35: | Line 32: | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value | rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 46: | Line 43: | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row(attr, prop.Value, scale_type, scale_value | rows = rows .. create_row(attr, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 52: | Line 49: | ||
-- then other data that is hidden on the ability card | -- then other data that is hidden on the ability card | ||
if ability.Other then | if ability.Other then | ||
for | for i, prop in pairs(ability.Other) do | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row( | rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 62: | Line 59: | ||
end | end | ||
function create_row(key, value, scale_type, scale_value) | |||
function create_row(key, value, scale_type, scale_value | |||
if key == nil or value == nil then | if key == nil or value == nil then | ||
return '' | return '' | ||
end | end | ||
local row = '|' .. key .. '||' .. value | |||
local row = '|' .. | |||
if scale_type and scale_value then | if scale_type and scale_value then | ||
row = row .. '||' .. scale_type .. '||' .. scale_value | row = row .. '||' .. scale_type .. '||' .. scale_value | ||
end | end | ||
return row | return '\n|-\n'..row | ||
end | end | ||
return p | return p | ||