Module:Weights

local p = {}

function p.test( arg ) return p.gamemode( mw.getCurrentFrame:newChild{ title = mw.title.new( "Game modes" ), args = { arg } } ) end

function p.gamemode( frame ) local weights = { default = 20, foolish = 8, mad = 4, lycan = 6, aleatoire = 4, alpha = 5, noreveal = 2, evilvillage = 1, charming = 4, sleepy = 5 }	local total = 0 for k, v in pairs(weights) do		total = total + v	end assert( frame.args[1], "Must specify a game mode" ) local ours = weights[frame.args[1]] or 0 if ours == 0 then return "0" end return string.format( "%d (%.2f%%)", ours, (ours / total) * 100 ) end

return p