Lua API (Triggering)

We use a scripting language called Lua, which has been extended to provide functionality specific to the Pharos Controllers. Tutorials and reference manuals for the Lua language can be found at www.lua.org. We will not attempt to document the Lua language here, but just the Pharos specific extensions. Please contact support if you need assistance with preparing a script or if you would like some examples as a starting point.

Supports Lua v5.3.4.

Lua script editor

The Lua Script Editor allows you to edit scripts from Triggers, Conditions and Actions within Designer. The Script Editor is launched by pressing the Scripts & Modules button on the Trigger Toolbar, and selecting Scripts in the bottom pane:

The main area of the editor is the code editor where you enter the source code of the script. The code editor will colour the Lua syntax to aid readability. Standard clipboard shortcuts and undo/redo are supported.

To create a new script for use in Conditions or Actions click New Script.

Scripts can be opened using the Open option and closed with the on the Script Tab.

To import a Lua script from an external file, use Import.

To save a Lua script to a file, use Export.

To compile the script and check for syntax errors, use Build. If there are errors in the script, they will be displayed at the bottom of the window.

Changes to scripts are saved automatically.

Find

Pressing Ctrl(Cmd) + F will open the find bar in the script editor.

This allows you to search for text within your script.

Aa If selected, the case must match
|Abc| If selected, the whole word must match
.* If selected, Regular Expressions can be used in the search box

Pharos Trigger Scripts

Syntax

Where a function returns an Object (e.g. get_timeline(num)) additional functions and variables become available. To access a function, add a colon (:) between the functions:

get_timeline(1):start() –  This will get the timeline object for timeline 1 and apply the start function to it (starting timeline 1)

To access a variable, add a period (.) between the function and the variable:

get_timeline(1).is_running – This will return a boolean value indicating whether timeline 1 is running
Pharos Lua API

This is documented along with the rest of the API here.

Related Topics Link IconRelated Topics