Module:Dice/Format: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
local dice = Dice.fromString(frame.args.roll) | local dice = Dice.fromString(frame.args.roll) | ||
if (frame.args.template ~= nil and frame.args.template ~= '') then | if (frame.args.template ~= nil and frame.args.template ~= '') then | ||
templatetitle = frame.args.template | |||
else | else | ||
templatetitle = 'Dice string' | |||
end | end | ||
return frame:expandTemplate{ | return frame:expandTemplate{ |
Revision as of 14:27, 31 July 2019
local Dice = require'Module:Dice'
local DiceStats = {}
function DiceStats.diceStats(frame)
local dice = Dice.fromString(frame.args.roll)
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 DiceStats