Javascript Invoke FunctionObject from native?

Hey Jules,

I have a Lua gui system that I'm attempting to port over to your Javascript engine.  I'm wondering how I can pass a javascript function to native code for execution at a later point.  For example, registering functions to fire for "click" events.  



//onClick is a method on my registered dynamic object
dyn.onClick(function() {
    //do stuff


static var onClick(Args a) {

    var func = a.arguments[0];
    //Debugger shows that it is a JavascriptEngine::RootObject::FunctionObject *
    //but RootObject is private so it's off limits.


I've just been piecing things together as I go, so I could easily be missing something obvious.


Hmm.. Yes, to do that I think it would need some extra kind of method in the JavascriptEngine class to invoke it.