This set of functions are used in combination with tasks. Some functions provide helper functionality that are only invokable within LUA functions that are executed by task (cf. Section 4.5.2). .
Furthermore, there are functions included that can be used to add and delete task definitions directly within LUA scripts. Using them provides the opportunity to dynamically create task that are not listed within the task definition file. Note that adding and deleting of task can only be done during server start up (e.g. within the callback "OnInitEvent").
Description
Signature
string nxa.SourceItemID | nxa.SourceVar ()
This function can be used to query the ID of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.
Parameters
None.
Return
...
Description
Signature
string nxa.DestinationItemID ()
This function can be used to query the ID of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.
Parameters
None.
Return
...
Description
Signature
nxa.SetDestinationValue (variant)
This function can be used to set a new value for the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks. Note that the new value will only be set within the server - it will not be forwarded to the field device.
Parameters
...
Return
None.
Description
Signature
nxa.WriteDestinationValue (variant)
This function can be used to write a new value to the destination item that is configured within the corresponding task. Compared to setting a value, a value write will also propagate the value change to the field device. This function can only be used within LUA functions that are invoked by tasks.
Parameters
...
Return
None.
Description
Signature
variant nxa.ReadDestinationValue ()
This function can be used to read the current value of the destination item that is configured within the corresponding task. This function can only be used within LUA functions that are invoked by tasks.
Parameters
None.
Return
...
Description
Signature
variant nxa.InputValue | nxa.SourceValue ()
This function can be used to query the value of the source item that triggered the corresponding task. This function can only be used within LUA functions that are invoked by tasks.
Parameters
None.
Return
...
Description
Signature
nxa.ExecuteDelayedScript (string, number)
This function executes a LUA script that is specified as String parameter. The execution can optionally be delayed.
Parameters
...
Return
None.
Description
Signature
nxa.AddWriteTask (string, string, bool, bool, bool, number, variant)
This function adds a new "WRITE" task definition during runtime.
Parameters
...
Return
None.
Description
Signature
nxa.AddReadTask (string, string, bool, bool, bool, number)
This function adds a new "READ" task definition during runtime.
Parameters
...
)
...
Return
None.
Description
Signature
nxa.AddSetTask (string, string, bool, bool, bool, number, variant)
This function adds a new "SET" task definition during runtime.
Parameters
...
Return
None.
Description
Signature
nxa.AddScriptTask (string, string, bool, bool, bool, number, string, number)
This function adds a new "SCRIPT" task definition during runtime.
Parameters
...
Return
None.
Description
Signature
bool nxa.AddVarTask (string, string, number)
This function can be used to add a task that is triggered if a variable changes its value.
Parameters
...
Return
...
Description
Signature
nxa.RemoveScriptTask (string, number)
Removes all "SCRIPT" tasks matching the provided parameters from the runtime system, even if defined in the definition file.
Parameters
...
Return
None.
Description - INTERNAL DOCUMENTATION
Signature
nxa.ExecuteXCommandValue (string)
This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.
Parameters
...
Return
None.
Description - INTERNAL DOCUMENTATION
Signature
nxa.ExecuteXCommand (string, string, ...)
This function is used to execute an XLogic command within LUA. This version takes a single string as parameter which includes all parameters.
Parameters
...
Return
None.
Description - INTERNAL DOCUMENTATION
Signature
number nxa.GetFreeTransactionID ()
This function returns the next free transaction IDs which can be used to identify a task. The transaction ID is never reused. The transaction ID can be used as last parameter for the functions nxa.SetValue, nxa.WriteValue, nxa.ReadValue, nxa.SetDestinationValue, nxa.WriteDestinationValue, nxa.ReadDestinationValue, nxa.ExecuteDelayedScript
Parameters
None.
Return
...
Description - INTERNAL DOCUMENTATION
Signature
nxa.CancelTransaction (number)
Aborts a currently running task using its transaction ID.
Parameters
...
Return
None.