Executing a Lua function from a Lua script file

To execute a Lua function from a Lua script file, you use the Execute Lua Function From File action. You must first create the script and then upload it to the Staging Browser.
When defining the action, you can select the Lua script file, the Lua function, and define any input and output parameters that you want to pass between the Lua function and the trigger action.

The advantage of using this action instead of the Execute Lua Script action is that you can edit and save more complex Lua functions in a separate Lua script file. The Lua script file can have one or more Lua functions that you may want to use in multiple triggers.

Assumptions

  • You know how to define and edit triggers. The trigger List Editor is shown, the Canvas Editor can be used as well. The flow is similar.
  • You are familiar with the Lua language syntax.
  • You know how to upload files to the Staging Browser using the Workbench.

The example

The following will walk you through the steps to define a trigger that will execute a Lua function from a Lua script:

The export file for this trigger can be downloaded to your computer and then imported into your node using the Workbench.
Once the steps are finished, your trigger should look similar to the trigger in the export file: Trigger_project_MyNewTrigger.dwx.

Go to: Step 1 - Writing the Lua function