Question RE Returning Null or 'Data' from Hook FN

BlitzMax Forums/BlitzMax Beginners Area/Question RE Returning Null or 'Data' from Hook FN

Creating a "Master Event Hooker" object sounds like a viable solution. Instead of calling
Addhook EmitEventHook, ThisHookFunction

I would call "TMasterHooker.RegisterHook(TMyType)" with some parameters to control hook direction.

Then, I would simply add a single hook for the "TMasterHooker", and call TMasterHooker.RegisterHook(TMyType) for each type to be hooked in order of most common to least common.

The MasterHooker would iterate through its internal list of registered hooks, checking IDs, and then make the appropriate function call. After returning from that function call, I would simply break out of the iteration loop to prevent the other conditional checks.


Not sure how expensive the custom type overhead in Blitzmax can be. This solution may be more trouble than it's worth. JSP - no, at this moment it's more of an intellectual exercise. I have not sought to measure a performance hit. This is all a fairly low priority on my todo list. I was simply wondering if there was an easy or common way to shed a few conditionals.

Thank you all for your responses!