Module:Products: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(increase smw limit)
(Rename "item" parameter to "1", since many pages are using it like that anyways)
Line 11: Line 11:
function p._main(args)
function p._main(args)
args = args or {}
args = args or {}
args.item = args.item or mw.title.getCurrentTitle().text
local item = args[1] or mw.title.getCurrentTitle().text
local showPrices = yesno(args.showPrices)
local showPrices = yesno(args.showPrices)
local showValues = yesno(args.showValues)
local showValues = yesno(args.showValues)
Line 17: Line 17:
-- Query for data
-- Query for data
local smw_data = mw.smw.ask{
local smw_data = mw.smw.ask{
'[[Uses item::' .. args.item .. ']]',
'[[Uses item::' .. item .. ']]',
'?Uses item',
'?Uses item',
'?Recipe JSON',
'?Recipe JSON',
Line 24: Line 24:
}
}
if not smw_data then
if not smw_data then
return ('There are no known products for item [[%s]]'):format(args.item)
return ('There are no known products for item [[%s]]'):format(item)
end
end