Hi, I write a simple plugin to implement 'function' object like in C1.
There is my plugin and test capx.
dl.dropbox.com/u/5779181/plugins.7z
I call 'runtime.trigger' in acts.CallFunction to trigger cnds.OnFunctionCalled.
acts.CallFunction = function (name)
{
this._function_name = name;
??this.runtime.trigger(cr.plugins_.MyFunction.prototype.cnds.OnFunctionCalled, this);
};
cnds.OnFunctionCalled = function (name)
{
return (this._function_name == name);
};
It works fine, OnFunctionCalled can be triggered correctly.
But, there are something wrong when go back to caller.
I find that in eveng.js, function: run_actions_and_subevents
// Run each action
for (evinfo.actindex = 0, len = this.actions.length; evinfo.actindex < len; evinfo.actindex++)
{
?if (this.actions[evinfo.actindex].run())
return;
}
evinfo.actindex is incorrected when runtime.trigger finished.
In my test case,
evinfo.actindex = 2 when executing action line 3 (Call function).
Event "On function" only has 1 line, so that evinfo.actindex = 1 when leaved.
Now, go back to previous for loop (run_actions_and_subevents). The evinfo.actindex changed to 1 (before was 2)
So that line 3 will be executed again, and again.
Do I miss something about using 'runtime.trigger'?