Passing a function as an argument

Hi everybody,

My question is slightly complicated : I have a global function that does some stuff with a LoadVars in it.
I 90% of the cases, the onLoad reference of the LoadVars is the same, but I sometimes need to do something else when the LoadVars is loaded.

Is there a way to pass a function reference to a function so that I could do something like that :

_global.function myFunction(maybeFunction)
myLoadVars = new LoadVars();
if (maybeFunction != undefined)
myLoadVars.onLoad = maybeFunction;
myLoadVars.onLoad = function(ok)


If not, any other Idea ?