First, the basic question, is there a simple way to make a function to add/remove/retrieve event handlers on a script?
More importantly though, is there any way we could get a function to create a "temphandler" or such, which is in effect just an event handler link to a function? For instance: temphandler(myfunction, "test event") would make it so that whenever the event "test event" was raised, it would call myfunction() with the event's arguments, just as if it had been defined in a script manually with the event handler added there. The ability to create these permanently would be helpful as well, but not necessary with proper care in coding.
The above should be able to cover just about every need from this sort of thing, including effectively allowing the automated import and update of scripts, the creation of more dynamic and functional scripts like Iocun's path walker without requiring manual modification to adjust events, and so on.
[Feature Request] Event Handler manipulation
Re: [Feature Request] Event Handler manipulation
There is a function to add event handlers to a function. Not perfect. It was introduced in pre8.
Re: [Feature Request] Event Handler manipulation
Interesting. What is it? I'm not 100% clear on the order of versions, but I do believe both my systems should have it given that, and I haven't noticed it thus far. I'll test it out and see if my request is still valid.
Re: [Feature Request] Event Handler manipulation
registerAnonymousEventHandler() I think. Something of that sort.
Re: [Feature Request] Event Handler manipulation
No clue if you can pass actual functions; I don't believe this function is documented anywhere useful. But there it is; you cannot pass functions in tables, either.
Re: [Feature Request] Event Handler manipulation
I know Heiko posted a few examples for it in the pre8 thread.
Re: [Feature Request] Event Handler manipulation
Hey Oneymus,Oneymus wrote:No clue if you can pass actual functions; I don't believe this function is documented anywhere useful. But there it is; you cannot pass functions in tables, either.
Why don't you add it to the wiki? Doesn't take much. If you're not sure abou the format just add it then msg me and I will pretty it up.
Re: [Feature Request] Event Handler manipulation
I'll handle that. I found it, have been using it, but yeah, only takes string input. Still, that's workable, and potentially easier in the manner I want to use it. Seems to work fine to me as well, though gods forbid if I wanted to adjust the event handlers I set.