Module:Dice/Compare: Difference between revisions
Jump to navigation
Jump to search
(Created page with "local DiceCompare = {} local Dice = require'Module:Dice' function DiceCompare.compare(frame) local comparison, why = Dice.compare(frame.args.dice_a, frame.args.dice_b)...") |
(forgot to update this when i updated Dice) |
||
Line 3: | Line 3: | ||
function DiceCompare.compare(frame) | 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 | local which | ||
Latest revision as of 22:09, 31 August 2023
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