Module:Dice/Compare
Jump to navigation
Jump to search
local DiceCompare = {}
local Dice = require'Module:Dice'
function DiceCompare.compare(frame)
local dice_a = Dice.parse(frame.args.dice_a)
local dice_b = Dice.parse(frame.args.dice_b)
local comparison, why = dice_a:compare(dice_b)
local which
if comparison > 0 then
which = frame.args.dice_a
elseif comparison < 0 then
which = frame.args.dice_b
else
which = ''
end
return frame:expandTemplate{
title = 'CompareDice/Format',
args = {
which = which,
why = why,
},
}
end
return DiceCompare