57.1. LUA scripts

The SCRIPT resource allows to run Lua scripts together with CPX standard behaviour and functionality. The Lua programming language has been chosen for this purpose because it's simple, stable, and powerful.

57.1.1. Activating the LUA Script resource

Add the resource to the Abilis system with the following command:

[15:43:30] ABILIS_CPX:a res:script

RES:Script ALREADY EXISTS

The SCRIPT resource may already exist in the system, but may not yet be active: set it active with the command:

[16:02:48] ABILIS_CPX:s act res:script

COMMAND EXECUTED
[Caution]Caution

After adding or setting the SCRIPT active, you must restart the Abilis to make the resource running (use the command warm start to reboot the Abilis).

[16:51:53] ABILIS_CPX:s p script act:yes

COMMAND EXECUTED

[16:52:04] ABILIS_CPX:d p script

RES:Script - Not Saved (SAVE CONF), Not Refreshed (INIT) ----------------------
       ------------------------------------------------------------------------
Run    DESCR:Lua_scripting_service
       LOG:NO        ACT:YES    bg-sesnum:5    tcp-sockets:10  udp-sockets:10
       wdir:C:\APP\SCRIPT\
       - Background scripts ---------------------------------------------------
       id:0  startup:NO   file:
       id:1  startup:NO   file:
       id:2  startup:NO   file:
       id:3  startup:NO   file:
       id:4  startup:NO   file:

57.1.2. LUA SCRIPT resource parameters

Use the following command to display the parameters of the resource; by typing d p script ? command it's possible to display the meaning of all parameters.

[16:52:04] ABILIS_CPX:d p script

RES:Script --------------------------------------------------------------------
Run    DESCR:Lua_scripting_service
       LOG:NO        ACT:YES    bg-sesnum:5    tcp-sockets:10  udp-sockets:10
       wdir:C:\APP\SCRIPT\
       - Background scripts ---------------------------------------------------
       id:0  startup:YES  file:
       id:1  startup:NO   file:
       id:2  startup:NO   file:
       id:3  startup:NO   file:
       id:4  startup:NO   file:

Meaning of the parameters:

LOG

Logging functionalities activation/deactivation.

ACT

Operation activation [NO, YES].

bg-sesnum

Maximum number of background sessions [0..50].

tcp-sockets

Maximum number of TCP sockets that can be opened by all LUA scripts [0..100].

udp-sockets

Maximum number of UDP sockets that can be opened by all LUA scripts [0..100].

wdir

Directory containing script files. Full path with drive letter ['C'..'Z'] terminated by '\'. Max 128 chars. Spaces require double quotes (E.g. "C:\My dir\").

id

Script index [0..(bg-sesnum - 1)] or A or ALL.

startup

Enable/disable the script execution at system startup [NO, YES].

file

Script file name. Max 32 chars. Spaces require double quotes (E.g. "my script").

The following command allows the administrator to change the configuration of the resource:

s p script parameter:value...

[Caution]Caution

To activate the changes made on the upper case parameters, execute the initialization command init res:script; while to set act the changes made on the lowercase parameters a save conf and an Abilis restart are required (i.e. With warm start command).