Legrand / Raritan Xerus™ JSON-RPC API for Remote Access Devices like KX4-101, KX3G2

Loading...
Searching...
No Matches
Classes
luaservice Module Reference

Lua-Service. More...

## Classes
struct | Environment
| The struct represents two kinds of information: More...
interface | Manager
| There is a single manager instance. More...
struct | ScriptOptions
| some script options More...
struct | ScriptState
| A structure that descripts the state of a script. More...

## Detailed Description

Lua-Service.

Lua-Service is a service that you can use to upload and execute a Lua script.

When the service is starting, a cleanup will be happend at first. That means still running scripts will be killed and it will be tested for which script is an option given. Does here something not match, then the script or the option will be deleted.

After the service is launched, the option 'autoRestart' will be for any script evaluated. If the flag is 'true', the script is going to be executed with a short delay (Environment->autoStartDelay).

You can download and upload a script with the commands getScript() and setScript(). When on uploading the script name is not present a new script will be created. If the name is already taken, then the old script will be overwritten.

Use startScript() to execute a lua script and terminateScript() to stop a script. If the option 'autoRestart' is set to 'true', then the script starts automatically after it has exited.

To get the output for a script use the command getScriptOutput(). The output is limited to 'Environment->outputBufferSize' bytes and mapped to a virtual address. On the first query call the method with starting address zero. After that use the returned address 'nAddr' for the next request.

A script can be called with arguments (see options and startWithArgs).