How to Get Parameters Which Weren't Declared
Posted: Sat Dec 31, 2011 4:55 pm
Hey everyone, I've got plans to introduce an expandable event dispatch system in my software that works by using an in memory XML table to hold a list of event names and then inside each node there would be a list of stacks registered to recieve those events and of course an API in place to allow said system to be extended by third party code to add its own events for others to be notified of.
But in order to support said system I'm having to think forward to the kinds of arguments that code may need to pass along with the event, for example if I have a function that logs off a user and a stack has registered to be alerted so that it could perform some kind of clean up, I could dispatch an event which sends the username as well to the stack waiting to be alerted. So my question is this how can my event dispatch function get all the parameters that were originally passed to it even though these extra parameters may not have been originally declared in the script. Essentially my _EventDispatch() function would be laid out like this in the script.
How could I retrieve any additional parameters that weren't originally coded in without having to resort to asking developers to construct a single string full of them which looks unclean and isn't easy to read nor debug. I've heard the Params() function may be able to help me but the dictionary is a little vague about how to properly use it.
Thanks, Michael.
But in order to support said system I'm having to think forward to the kinds of arguments that code may need to pass along with the event, for example if I have a function that logs off a user and a stack has registered to be alerted so that it could perform some kind of clean up, I could dispatch an event which sends the username as well to the stack waiting to be alerted. So my question is this how can my event dispatch function get all the parameters that were originally passed to it even though these extra parameters may not have been originally declared in the script. Essentially my _EventDispatch() function would be laid out like this in the script.
Code: Select all
Function _EventDispatch pEventName
Thanks, Michael.