Module:Dice/Format
Jump to navigation
Jump to search
local Dice = require'Module:Dice'
local DiceFormat = {}
function DiceFormat.diceStats(frame)
local dice = Dice.fromString(frame.args.roll)
local templatetitle
if (frame.args.template ~= nil and frame.args.template ~= '') then
templatetitle = frame.args.template
else
templatetitle = 'Dice string'
end
return frame:expandTemplate{
title = templatetitle,
args = {
minimum = dice:minimum(),
mean = dice:mean(),
maximum = dice:maximum(),
},
}
end
return DiceFormat