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