Module:ExpandTank

local p = {}

-- expand  [the minimum size to fill (0-1) (defaults to .2 or 20%)] function p.expand( f ) local args = require( Module:ProcessArgs ).fromParent( f )

if #args == 0 or args[1] == nil then return args[2] end

local tankHtml = mw.getCurrentFrame:preprocess( args[1] ) local maxSize = args[2] local minDiff = (args[3] ~= nil and args[3] < 1) and args[3] or 0.2 local total = 0

for thing in mw.ustring.gmatch(tankHtml, '"&7(%d+) mB"') do		if tonumber(thing, 10) ~= nil then total = total + thing end end

local diff = total / maxSize local result if diff < minDiff then result = total / minDiff end return result end

return p