Originally Posted by Vladinator
Code:
local orig = SendChatMessage
function SendChatMessage(text, chan, ...)
if chan ~= "EMOTE" then
local emote = text:match("*(.+)*")
if emote then
text = text:gsub("*(.+)*", "")
orig(text, chan, ...)
return DoEmote(emote)
end
end
return orig(text, chan, ...)
end
|
There's a couple errors in the pattern. The asterisk is a magic character that needs to be escaped. Also, you need the capture to match as little as possible so it doesn't try to overflow outside the terminating asterisk if another one exists in the message or multiple emotes are in the message. You should use either "%*([^%*]-)%*" or "%*(.-)%*".