Module:Products: Difference between revisions

101 bytes added ,  30 November 2024
Make limit a parameter; Make used item images smaller
(Rename "item" parameter to "1", since many pages are using it like that anyways)
(Make limit a parameter; Make used item images smaller)
Line 14:
local showPrices = yesno(args.showPrices)
local showValues = yesno(args.showValues)
local limit = tonumber(args.limit or 0) or 0
if limit <= 0 then
'limit = 500',
end
 
-- Query for data
Line 20 ⟶ 24:
'?Uses item',
'?Recipe JSON',
showValues and '?Value',
'limit=500',
limit = limit
showValues and '?Value'
}
if not smw_data then
Line 68 ⟶ 72:
-- Create table
local out = mw.html.create('table')
:addClass('wikitable align-right-1')
:tag('tr')
:tag('th')
Line 123 ⟶ 127:
for _, item in ipairs(recipe.materials) do
ingredients:tag('li')
:wikitext(('%s &times; [[File:%s.png|link=%s|30px18px]] [[%s]]'):format(item.quantity, item.name, item.name, item.name))
:done()
end
1,207

edits