Module:Abilities: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) No edit summary |
Gammaton32 (talk | contribs) simplified get_ability_prop code, working on adding more variables |
||
| Line 40: | Line 40: | ||
local prop1 = frame.args[2] | local prop1 = frame.args[2] | ||
local prop2 = frame.args[3] | local prop2 = frame.args[3] | ||
local | local number_str = frame.args[4] | ||
local number_int = tonumber(number_str) | |||
--find ability JSON name-- | |||
local ability = get_json_ability(ability_name) | local ability = get_json_ability(ability_name) | ||
if(ability == nil) then return "Ability Not Found" end | if(ability == nil) then return "Ability Not Found" end | ||
--identify if prop1 is a table, then use prop2-- | |||
local element = ability[prop1] | |||
if (element == 'table') then | |||
local | local list1 = element[prop2] | ||
local element = list1 | |||
if (list1 == 'table') then | |||
local list2 = list1[number_int] | |||
local element = list2 | |||
end | end | ||
end | end | ||
return | if (element == nil) then return "" end | ||
return element | |||
end | end | ||
return p | return p | ||