HMS Networks IXXAT CAN@net NT User Manual page 21

Table of Contents

Advertisement

Lua API Function and Module Reference
References to additional function parameters are also possible:
-- copy 2 byte variables and 2 bytes from the source array to the
destination array
format = array.compile("@1,@2,#3,#4")
dest_array = array.repack(format, src_array, var1, var2)
-- this corresponds to
dest_array[1] = var1
dest_array[2] = var2
dest_array[3] = src_array[3]
dest_array[4] = src_array[4]
Important to know:
The length of the destination array is directly given by the format string length.
The maximum value for a reference (e.g. #8) is the source array length.
The maximum number for variable references (e.g. @1) is 32.
Valid value for variables are 0 to 255 (unsigned byte).
The maximum value for a constant is 255, or 0xff.
Function 'array.repack'
dest_array = array.repack(format, src_array)
Packs the data from the array src_array according to the compiled format string `format
and returns the result array.
Valid Operations on Arrays
Read a value
val = a[2]
Write a value
a[1] = val
Size of the array
num_bytes = #a
Concatenate two arrays
arr_c = arr_a .. arr_b
Iterate over an array
`lua for _,v in ipairs(a) do
CAN@net NT/CANbridge NT User Manual
-- do something end
19 (22)
4.02.0332.20002 1.2 en-US

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the IXXAT CAN@net NT and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Ixxat canbridge nt

Table of Contents