I try to extract the itemId from a loot message but am not sure how to do this.
For example I have the following loot message.
"You receive loot: |cffffffff|Hitem:2589::::::::13:::::::|h[Linen Cloth]|h|r."
I use the this funtion to extract the number:
Lua Code:
-------------------------------------------------------------------------------
-- Extract the number from a message
-------------------------------------------------------------------------------
local CA_match_number
local function ClassicAchievements_Match_number(line)
CA_match_number, = string.match(line,"%d+")
if CA_match_number ~= nil then
print(CA_match_number)
return(CA_match_number)
end
return(0)
end
This will work just fine is the itemId is the biggest number in the message.
But it will fail if there is a bigger number in the message.
It there a way to extract the first number from a text string?