Module:ItemData: Difference between revisions

TheMilkMan (talk | contribs)
Trying to extend get_component_name to allow lookup of a second value, currently only for Leech components
LVL (talk | contribs)
Filter out disabled items in component lookups
Line 353: Line 353:
if (component_key == nil) then return nil end
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
local component = data[component_key]
if (component == nil or component["IsDisabled"] == true) then return nil end
return component['Name']
return component['Name']
Line 482: Line 483:
local parents = {}
local parents = {}
for key, item in pairs(data) do
for key, item in pairs(data) do
if item.Components and type(item.Components) == "table" then
if item.IsDisabled ~= true and item.Components and type(item.Components) == "table" then
for _, comp in ipairs(item.Components) do
for _, comp in ipairs(item.Components) do
if comp == target_key then
if comp == target_key then