Return data from Executor
miresru opened this issue ยท 4 comments
Ho I can return some data from Executor back to my script?
For example:
I have Executor
function TEST(args){
var myvar = "Output";
return myvar;
}
And when a call it by #TEST
from my script how I can take myvar
value?
Placeholder works exactly like Executors
Except, now the return value will be directly passed to the Trigger.
For example,
https://github.com/wysohn/TriggerReactor/blob/master/src/main/resources/Placeholder/isop.js
If you look at the code, all it does is get information from 'player' and return it.
So if $isop was called in the Trigger, isop.js will be executed, and the value will be return to the caller.
return for the Executor is not intended to be used for the real 'return' but to notify the code interpreter some predefined behaviors.
For example, it is possible to terminate the Trigger in the progress of the interpretation by returning STOP.
If you want to create something like a 'function,' consider using NamedTrigger. By using #CALL, you can invoke the NamedTrigger inside another triggers. And NamedTrigger with the caller Trigger shares the variables.