Module:Dice/Format: Difference between revisions

139 bytes added ,  16:30, 12 September 2019
autodetect which kind of string we wanted
(add truncated mean; minor refactoring)
(autodetect which kind of string we wanted)
Line 4: Line 4:


function DiceFormat.diceStats(frame)
function DiceFormat.diceStats(frame)
     local dice = Dice.fromString(frame.args.roll)
     local succeeded, result = pcall(Dice.fromRangeString, frame.args.roll)
 
    if not succeeded then
        result = Dice.fromDiceString(frame.args.roll)
    end
 
    local dice = result


     local templatetitle = 'Dice string'
     local templatetitle = 'Dice string'