I've never really been able to understand how to work in arguments into my "OnEvent" frames, and now I need to use it. I'm trying to make it so my addon does a certain function when the auras of my target change, so I went about it like this:
Code:
local OnEvent = CreateFrame("Frame")
OnEvent:SetScript("OnEvent", function(self, event, addon, ...)
if (event=="UNIT_AURA") then
if (arg1=="target") then
myFunction()
end
end
end)
OnEvent:RegisterEvent("UNIT_AURA")
I have no idea if I'm doing this right, I'm going to guess no since it's not working :P If anyone could help I'd be very appreciative!
Thanks!!