Module:ItemData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Fix get_builds_into to expand {{ItemIcon}} templates internally using expandTemplate so they render correctly inside #if conditionals instead of showing raw wikitext. |
TheMilkMan (talk | contribs) Trying to extend get_component_name to allow lookup of a second value, currently only for Leech components |
||
| Line 339: | Line 339: | ||
p.get_component_name = function(frame) | p.get_component_name = function(frame) | ||
local item_name = frame.args[1] | local item_name = frame.args[1] | ||
local slot_arg = frame.args[2] | |||
local item = get_json_item(item_name) | local item = get_json_item(item_name) | ||
if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end | if(item == nil) then return "<span style=\"color:red;\">Item Not Found.</span>" end | ||
| Line 346: | Line 348: | ||
if(components == nil) then return nil end | if(components == nil) then return nil end | ||
local component_key = components[ | local slot = tonumber(slot_arg) or 1 | ||
local component_key = components[slot] | |||
if (component_key == nil) then return nil end | |||
local component = data[component_key] | local component = data[component_key] | ||
if (component == nil) then return nil end | if (component == nil) then return nil end | ||