Lua API Function and Module Reference
Function 'sys.logging'
sys.logging(severity, message)
Writes a test message into the LOG/ERR file, e.g. sys.logging("E", "my log message").
•
severity: possible values: e'X'ception, 'E'rror, 'W'arning, or 'L'ogging
•
message: text string
5.2.5
Module 'json'
The module json is optional and has to be loaded via json= sys.dofile('json.lua').
Function 'json.encode'
json.encode(val)
Serializes the provided value as JSON string. The result is returned. Allowed data types for
value are boolean, number, string, and table.
Function 'json.decode'
json.decode(st)
De-serializes the provided JSON string. The result is returned.
5.2.6
Module 'array'
The module array is loaded by default and directly available.
Provides the data type array which is a userdata byte array with up to 64 bytes, used for CAN
messages payload.
The module provides functions to generate and modify byte arrays in C which is more efficient
than doing this in Lua, like:
•
extract data bytes from an array
•
insert data bytes into an array
•
repack data from one array into another
Function 'array.new'
a = array.new(64, 0)
-- OR
a = array.new({1, 2, 3, 4, 5 ,6 ,7 ,8})
Creates a new instance of type array. The first parameter is used as size (number of bytes) , the
second parameter as initialization value for the array.
A provided table is used as list of initialization values.
Array/table indexes in Lua always start with 1 (instead of 0 as in many other languages).
Function 'array.extract'
a = array.extract(a, first [, last])
Returns an extract of a that starts at first and continues until last. If last is absent, then it
is assumed to be equal to the array length.
CAN@net NT/CANbridge NT User Manual
17 (22)
4.02.0332.20002 1.2 en-US
Need help?
Do you have a question about the IXXAT CAN@net NT and is the answer not in the manual?