Module:Infobox Recipe: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 13: Line 13:
--Get each of the rawmatX parameters from params and store their values in a new table
--Get each of the rawmatX parameters from params and store their values in a new table
local argsMaterials = p._extractRawMaterials(args)
local argsMaterials = p._extractRawMaterials(args)
mw.logObject(argsMaterials)
--empty tables to hold materials
--empty tables to hold materials
local rawMaterials = {}
local rawMaterials = {}
Line 23: Line 22:
--get the value for the output product
--get the value for the output product
local output1Value = args.output1 and mw.smw.ask('[[:+]][[' .. args.output1 .. ']]|?Value|limit=1')
local output1Value = args.output1 and mw.smw.ask('[[:+]][[' .. args.output1 .. ']]|?Value|limit=1')
local output1TotalValue
local output1TotalValue = 0
mw.logObject(output1Value)
if output1Value ~= nil then
if output1Value ~= nil then
output1TotalValue = output1Value[1]['Value'] * (tonumber(args.output1qty) or 1)
output1TotalValue = output1Value[1]['Value'] * (tonumber(args.output1qty) or 1)
Line 40: Line 40:
rawMaterials = argsMaterials
rawMaterials = argsMaterials
end
end
mw.logObject(rawMaterials)


--Simple query to get the shop buy price for the provided material, if no buy price is available returns 0
--Simple query to get the shop buy price for the provided material, if no buy price is available returns 0