Lua Trigger functions
dw.trigger.execute
status, outputs = dw.trigger.execute(project, trigger, inputs, wait_for_completion)
Description
Execute a subtrigger defined on this node. The user specifies the project and trigger as strings, and the input variables as a Lua table. The function returns the status and output variables as a table. If the user specifies "wait_for_completion" as false, then the outputs will always be nil.
Inputs
- project: a STRING value of the project name
- trigger: a STRING value of the trigger name
- inputs: a Lua table of input variables to the subtrigger. Example: local inputs = {one=1,two=2,three=3}
- wait_for_completion: a STRING value of "true" or "false" (optional)
Outputs
- status: an error code if there is an error. 0 if subtrigger succeeds.
- outputs: a Lua table of the output variables from the subtrigger. The value is "nil" if "wait_for_completion" is false.
local i = {one=1,two=2,three=3}
local s, o = dw.trigger.execute("LUA_Trigger","subtrigger_echo_stopped",i);
local s, o = dw.trigger.execute("LUA_Trigger","subtrigger_echo_stopped",i,"false");
local my_inputs = DWInput["input"];
local i = {one=0,two=0,three=0};
i["one"]=my_inputs[1];
i["two"]=my_inputs[2];
i["three"]=my_inputs[3];
local s,out = dw.trigger.execute("LUA_Trigger","subtrigger_echo",i);
DWOutput["o"] = {out["out1"],out["out2"],out["out3"]};
DWOutput["s"] = s;
Example Subtrigger Inputs and Outputs
Following the usage above, the subtrigger must have the
following defined as input variables:
The corresponding subtrigger output variables would
be:
Related topics
For more information on passing subtrigger inputs and outputs in a Lua function, see Using Lua input and output parameters.