I'm using the CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS and I want my little function here to compare the arg1 from the event (wich returns: *some1 gains: *something") with the table of spells. And when it finds a spell it will add 1 to M
it works if I type the string directly in the code string.find("Restoration",spel) or make a_buff="Restoration" -BUT it don't work ingame?!?! I debugged it with DEFAULT_CHAT_FRAME:AddMessage(arg1) to se if the event really return a string, and it did
Code:
M=0
DispellType_Magic{
"Mighty Rage",
"Greater Dreamless Sleep",
"Living Free Action",
"Major Dreamless Sleep",
"Restoration"
}
if (event~="CHAT_MSG_SPELL_AURA_GONE_OTHER") then
a_buff=arg1
for i,spell in ipairs(DispellType_Magic) do
a=string.find(a_buff,spell)
if (a~= nil) then M=M+1; break;
end
end
end
(this is not the whole code)
Where do I go wrong?!?!