Module:WeightToPercent
Documentation for this module may be created at Module:WeightToPercent/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.main(frame)
local args = getArgs(frame, {trim = true, removeBlanks = true, parentOnly = true})
return p.convert(args)
end
function p.convert(args)
local weight = args[1]
local totalweight = args[2]
if weight == nil then return "ERROR: weight input (1rst arg) is nil"
elseif totalweight == nil then return "ERROR: totalweight (2nd arg) input is nil"
elseif weight == 0 then return 0
else return 100 * totalweight / weight end
end
return p