Script Editor

While the Console Display allows you to execute Lua scripts immediately within the system, the Script editor is used for writing Lua scripts, which you itend to be part of the functionality of an object.

This functionality can either be the script itself or it can be providing a functions library for subordinate objects.

The Script Editor can be used for objects which can execute Lua scripts or contain Lua libraries. To open the Script Editor you have to find the Lua Script Body property in the Properties Panel. Depending on the classes, the Lua Script Body property can be found in different sections of the Properties Panel.

For some (like Core and Connector objects) this property is located in the Script Library compound while for others (e.g. ActionItem) it is in the Common section. For Generic Items, you first have to set Generation Type in the section with the same name to 'Lua Script Data Generator' to reveal the Lua Script Body property in this section. While this may sound confusing in this general explanation, the different locations are the result of the different object types being specifically designed for specific tasks.

Once you have located the Lua Script Body property for your object, click on the …​ icon in that line to open the new Script Editor Window.

Most objects on a higher hierarchical level in the model can provide Script Libraries for subordinate objects. For more information on Script Libraries and how to add them to the system, see Mangaging Script Libraries.

Console Display
Figure 1. The Script Editor

The Script Editor is made up of 4 parts:

  • Menu Bar

  • Input Pane

  • Output Pane

  • Status Bar

The Menu Bar

In the Menu Bar you find the following icons:

Table 1. Script Editor - Menu Bar Options
Element Shortcut Action

icon save


Save the contents of the Input Pane as a (.lua-)file

icon open


Load a (.lua-)file into the Script Editor

icon mass config cut


Cut the selected part from the Input Pane to the Clipboard

icon mass config copy


Copy the selected part from the Input Pane to the Clipboard

icon mass config paste


Paste the contents of the Clipboard into the Input Pane at the position of the cursor.

icon mass config magnifier

Open the Search Dialog

icon mass config replace

Open the Replace Dialog

icon backward


Undo your latest edit

icon forward


Undo your latest 'Undo'

icon lua intellisense enable

Switch the LuaSense helper tool on / off

LuaSense provides suggestions based on the code being entered and displays information for functions including the necessary parameters and code examples.

icon lua comment

Comment out the selected lines

icon lua uncomment

Uncomment the selected lines

icon glasses

Switch Output pane invisible / visible

icon play


You can only 'run' scripts which belong to objects and are executable (no library). Running a script automatically applies the latest version of the script the Script Property of the Object.

The Input Pane

In the Input Pane of the Script Editor the Lua code can be entered. The Script Editor provides Syntax Highlighting and with Lua Sense enabled, it offers suggestions for code completion. To execute the code entered in the Input pane press "Execute" icon in the Menu Bar or F5.

The Output Pane

The results of the execution of a script are displayed in the output pane. The first element is a dot, which is green if the script finished successfully. In case of an error in the script, this dot turns red. The next item is the name of the Object, to which the script belongs. The last item in the output pane is the Value which is returned by a successfully executed script or an error message, specifying the location of the error in the script and the error type.

The Output Pane
Figure 2. The Output Pane

The Status Bar

On the right side of the statusbar the current position of the cursor shown by line ('Ln') and column ('Col'). Modifications of the script since its last execution are indicated by the word 'Modified', written in yellow, on the left side of the status bar.

The 'OK' button applies the current state of the script to the Script Property. The 'Cancel' button tries to close the Script Editor, asking for confirmation.

The Statusbar of a Script Editor window
Figure 3. The Statusbar of a Script Editor window