Legrand / Raritan / Server Technology Xerus™ JSON-RPC API
Loading...
Searching...
No Matches
luaservice Module Reference

Lua-Service. More...

Classes

struct  Environment
 Environment represents two kinds of information: More...
 
interface  Manager
 There is a single manager instance. More...
 
struct  ScriptOptions
 Script options. More...
 
struct  ScriptState
 A structure that describes 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 is done first. That means still running scripts will be killed and it will be tested for which script an option is given. If something does not match, the script or option will be deleted.

After the service is launched, ScriptOptions::autoStart will be evaluated for each script. If the flag is true, the script is going to be executed with a delay of Environment::autoStartDelay milliseconds.

You can download and upload a script with Manager::getScript() and Manager::setScript(). On upload, if the script name is already taken, the old script will be overwritten. Otherwise, a new script will be created.

Use Manager::startScript() to execute a Lua script and Manager::terminateScript() to stop a script. If ScriptOptions::autoRestart is set to true, the script restarts automatically after it has exited.

To get the output for a script use Manager::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 ScriptOptions and Manager::startScriptWithArgs().