Module:Skills/Cartography: Difference between revisions

Allow optional comma separated list of items
No edit summary
(Allow optional comma separated list of items)
Line 321: Line 321:


function p.getDiscoveryRewardsTable(frame)
function p.getDiscoveryRewardsTable(frame)
local itemNames = frame.args ~= nil and frame.args or frame
local itemNames = frame.args ~= nil and frame.args[1] or frame
local items = {}
local items = {}
for i, itemName in ipairs(itemNames) do
for itemName in string.gmatch(itemNames, "[^,]*") do
item = Items.getItem(itemName)
item = Items.getItem(itemName)
if item ~= nil then
if item ~= nil then
items[i] = item
table.insert(items, item)
end
end
end
end
if #items == nil then
if #items == nil then
return Shared.printError('No items found for with names: "' .. itemNames .. '"')
return Shared.printError('No items found in game data for: "' .. itemNames .. '"')
end
end
local resultTable = p._getDiscoveryRewardsTable(items)
local resultTable = p._getDiscoveryRewardsTable(items)
432

edits