Module:Items/ComparisonTables: Difference between revisions
From Melvor Idle
(getItemUpgradeTable: Implement parameter 'usedItem', for restricting results to only those using the specified item) |
(getTableFromList: Change to use one item per parameter/arg instead of a comma delimited list) |
||
Line 355: | Line 355: | ||
function p.getTableForList(frame) | function p.getTableForList(frame) | ||
local | local frameArgs = frame.args ~= nil and frame.args or frame | ||
local | local includeModifiers = frame.includeModifiers ~= nil and string.upper(frame.includeModifiers) == 'TRUE' or false | ||
local itemList, errItems = {}, {} | |||
local itemList = {} | |||
local errMsg = 'Some items not found in database: ' | local errMsg = 'Some items not found in database: ' | ||
local hasErr = false | local hasErr = false | ||
for i, | for i, rawItemName in ipairs(frameArgs) do | ||
local | local itemName = Shared.trim(rawItemName) | ||
if | local item = Items.getItem(itemName) | ||
if item == nil then | |||
table.insert(errItems, "'" .. itemName .. "'") | |||
else | else | ||
table.insert(itemList, | table.insert(itemList, item) | ||
end | end | ||
end | end | ||
if | if not Shared.tableIsEmpty(errItems) then | ||
return Shared.printError( | return Shared.printError('Some items not found in database: ' .. table.concat(errItems, ', ')) | ||
else | else | ||
return p._getEquipmentTable(itemList, includeModifiers) | return p._getEquipmentTable(itemList, includeModifiers) |