Originally Posted by Seerah
The best way is to listen for the appropriate events.
|
I'm doing that with an event handler but the problem is how do I get the delete another item only after the even has fired. there is a delay in when I call the event. So if I have
Lua Code:
for k1, v1 in pairs(mailInfo) do
d(delComplete)
if delComplete then DeleteMail(v1.mailId,false) end
delComplete = false --mark it as false only the event can mark it as true
end
and an event handler
Lua Code:
delComplete = true
function mailOpen.MailRemoved(eventCode, mailId)
delComplete = true -- mark it true from event code
d('mail removed')
end
It'll delete the first item and it won't delete the rest. I tried it like this. and get the same thing.
Lua Code:
for k1, v1 in pairs(mailInfo) do
DeleteMail(v1.mailId,false)
end
The chat window displays
Code:
true
false
false
false
false
false
mail removed
So the problem seems to be it runs through all the addon code first