Hello... I have an issue when extracting random_roll_result for a loot master addon i'm trying to write...
My issue with this is, that ":match()" returns strings... (Roll does not return as a value (88) but a string ("88") which makes comparing .... impossible? i don't know... But if anyone got a solution, i'd be happy
Lua Code:
local highestRoll = 0
local name, roll, minRoll, maxRoll = arg1:match("^(.+) rolls (%d+) %((%d+)%-(%d+)%)$") -- "Oijjoijj", "88", "1", "100"
if roll >= highestRoll then -- if "88" >= 0 then
if roll ~= highestRoll then
table.wipe(highestRoller)
highestRoll = roll
end
table.insert(highestRoller, 1, nameServer)
end
EDIT: Found solution... tonumber...
Lua Code:
local highestRoll = 0
local name, roll, minRoll, maxRoll = arg1:match("^(.+) rolls (%d+) %((%d+)%-(%d+)%)$") -- "Oijjoijj", "88", "1", "100"
local rollNum = tonumber(roll)
if rollNum >= highestRoll then -- if 88 >= 0 then
if roll ~= highestRoll then
table.wipe(highestRoller)
highestRoll = roll
end
table.insert(highestRoller, 1, nameServer)
end