Guys,
I did it and I want to share the solution in case someone asks the same question in the future.
I learned to do it by studying one of Rex.Rainbow's amazing extensions: "Command Queue"
so the code is all his. I made some comments in the code to simplify the understanding for
initiates.
// Check if there is Function Object loaded in the project
if (cr.plugins_.Function != null)
{
// Iterate through all names of the project's Object Types
for (name in this.runtime.types)
{
// We only want the first instance of the Function plugin, because
// there is only one in the project (plugin type is "object" not "world")
var inst = plugins[name].instances[0];
// Check if we found the Function object's single instance
if (inst instanceof cr.plugins_.Function.prototype.Instance)
{
// Store the instance and the action in variables
// The instance will be passed to the CallFunction when we call it
this.functionObjInstance = inst;
this.functionCallFunction = cr.plugins_.Function.prototype.acts.CallFunction;
break;
}
}
}
[/code:116h5l8p]
You can get the conditions and expressions as well. I'll only use the action "CallFunction" in my plugin.
Then you can call the function stored in the variable.
[code:116h5l8p]
// Then later in our code we are able to call "CallFunction" and pass the instance as
// the first parameter, the function name as the second and the parameter list as the
// third parameter
this.functionCallFunction.call(this.functionObjInstance, "fn_Example", "");
[/code:116h5l8p]
Thank you, rex, for your amazing extensions and for the code to be so easy to learn from.
Best regards to all!