Module:WeightToPercent

From eMushpedia
Revision as of 14:21, 19 November 2025 by imported>Septembre (debug 2: sanitize ?)
Jump to navigation Jump to search

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)
	return p.convert(args)
end
 
function p.convert(weight, totalweight)
	if weight == nil then return "ERROR: weight input is nil"
	elseif totalweight == nil then return "ERROR: totalweight input is nil"
	elseif weight == 0 then return 0
    else return 100 * totalweight / weight end
end
 
return p