I was getting that error too in instances where I had an event dispatching inside of another event handler.
But I think your issue might be scoping, it’s confusing your custom event with the timer event. Try changing the name of your custom event object to “myEvent” and pass that in the closed timer function. If you still get the error, maybe there’s a bug with dispatching events inside of event handlers.
timer.performWithDelay (1000, function (e) temp:dispatchEvent(event) end)[/lua]
No errors as long as you add a table event listener to the mix…
Going thru some permutations, it doesn’t seem to matter whether you add the normal function handler before of after the table event listener - as long as the latter is there all works fine.
local event = {name=“aaa”,target = temp}
timer.performWithDelay (1000, function () temp:dispatchEvent(event) end)[/lua]
odd bug, but solution kind of makes sense, as it follows the standard pattern we’ve seen for collision listeners etc
[lua]obj.collision = someFunction
obj:addEventListener(“collision”, obj)[/lua] [import]uid: 6645 topic_id: 8500 reply_id: 30643[/import]
The fact that it works with a table event listener and not with a function event listener is weird.
The fact that it works with both a table event listener and a function event listener as long as the table event listener is also registered, is weirder. This implies that the function event handler doesn’t crash anymore when the table listener is registered…
That was what I was trying to show in my example and hopefully that will help Ansca to fix it, because the weirder the behavior, the more obscure the bug…