Module:Mmgtable/display: Difference between revisions
Jump to navigation
Jump to search
(Created page with "-- <nowiki> local timefunc = require('Module:Time') local exg = require('Module:Exchange')._price local p = {} local lang = mw.getContentLanguage() function gep(x) return exg(x, 1, nil, nil, 0) end local MEMBERS_ICON = { [false] = "center|link=Free-to-play", [true] = "center|link=Members" } function round1k(x, f) if not tonumber(x) then return x end local _x = math.abs(x) _x = 1000 * math.floor(_x / 100...") |
(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 |
||
(10 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