Dialog

<< Click to Display Table of Contents >>

Navigation:  Function block library > Custom > Lua script >

Dialog

Previous pageReturn to chapter overviewNext page

The dialog has three tabs. The first one is used to configure the function block:

custom_lua_dialog_config

Here the number of inputs and outputs can be set. Besides, it is possible to specify if the script is to be executed in every step or only when one of the input values changes. Furthermore, the JIT compiler which is turned on by default can be disabled. If the JIT compiler is disabled the script won't be compiled to byte code but interpreted line by line. As this leads to lower performance, the JIT compiler should only be disabled for testing or debugging.

The script editor is used to enter the Lua script:

custom_lua_dialog_editor

The editor is divided into two areas: the upper area is used to declare and initialize variables that keep their values between the execution steps. The real calculation is implemented in the lower area. The inputs and outputs can be accessed via the local variables "in1" to "in20" and "out1" to "out20". Messages can be posted with the "print" command. After clicking the "Save" button, the script is adopted at once; it is not necessary to restart the program.

In the third tab "Log" the message from the Lua interpreter and the JIT compiler and the messages posted with "print" in the script are displayed.