How to Get Parameters Which Weren't Declared

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
SirWobbyTheFirst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 246
Joined: Tue Jun 30, 2009 11:15 pm

How to Get Parameters Which Weren't Declared

Post by SirWobbyTheFirst » 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.

Code: Select all

Function _EventDispatch pEventName
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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10356
Joined: Wed May 06, 2009 2:28 pm

Re: How to Get Parameters Which Weren't Declared

Post by dunbarx » Sat Dec 31, 2011 6:35 pm

Hmmm. Unless I misunderstand, read up on "the params" in the dictionary.

Craig Newman

Post Reply