Module:Mmgtable/display
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Mmgtable/display/doc
function p.main(frame)
local args = frame:getParent().args
local query = {'[[Category:Worthwhile money making guides]]', '[[MMG JSON::+]]', '?MMG JSON', '?=#', limit=10000}
if args[1] then
table.insert(query, 2, '[[Category:'..args[1]..']]')
end
local data = mw.smw.ask(query)
local totalProfit = 0
for i,v in ipairs(data) do
local val = calc_value(v['MMG JSON'].outputs, 0, true) - calc_value(v['MMG JSON'].inputs, 0, false)
totalProfit = totalProfit + val
end
return totalProfit
end