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.
To open the Script Editor for an Object which can execute Lua scripts (like ActionItem or Generic Item), select the object in the Model Panel and in the Properties Panel unfold the Common section and then click on the '…' icon in the Lua Script Body
line.
This opens a 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.

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:
Element | Shortcut | Action |
---|---|---|
Ctrl+Shift+S |
Save the contents of the Input Pane as a (.lua-)file |
|
Ctrl+Shift+O |
Load a (.lua-)file into the Script Editor |
|
Ctrl+X |
Cut the selected part from the Input Pane to the Clipboard |
|
Ctrl+C |
Copy the selected part from the Input Pane to the Clipboard |
|
Ctrl+V |
Paste the contents of the Clipboard into the Input Pane at the position of the cursor. |
|
Open the Search Dialog |
||
Open the Replace Dialog |
||
Ctrl+Z |
Undo your latest edit |
|
Ctrl+Y |
Undo your latest 'Undo' |
|
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. |
||
Comment out the selected lines |
||
Uncomment the selected lines |
||
Switch Output pane invisible / visible |
||
F5 |
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 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.
