Module:Mmgtable/display: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Replaced content with "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)...") Tag: Replaced |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
function p.main(frame) | 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 | |||
end | |||
return totalProfit | |||
end | end | ||
Latest revision as of 10:36, 5 May 2025
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