Home > HMS NETWORKS > HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide

HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide

C Funcons Called from Lua  
CAN@net NT/CANbridge NT Lua ADK  
NOTE  
Array/table indexes in Lua always start with 1(instead of 0as in many other languages).  
Funcon 'array.extract'  
a = array.extract(a, first [, last])  
Returns an extract of athat starts at firstand connues unl last. If lastis absent, then it is assumed to  
be equal to the array length.  
Funcon 'array.insert'  
a = array.insert(a, [pos,] value)  
Inserts element valueat posion posin a, shifing up the elements a[pos]···, a[#a]. The default value for  
posis #a+1, so that a call array.insert(a, x)inserts xat the end of array a.  
Funcon 'array.string_to_array'  
a = array.string_to_array("this is string")  
Converts a Lua string to a byte array. The length of the array corresponds to the number of string characters.  
Funcon 'array.array_to_string'  
s = array.array_to_string(a)  
Converts a byte array to a Lua string. Strings in Lua are not zero-terminated and can contain any arbitrary binary  
data.  
Funcon 'array.compile'  
format = array.compile(s)  
Generates a binary format string for array.repack()based on the given ASCII format string.  
array.repack()allows a re-packaging of data bytes from one array into another. The format string denes  
which bytes are used and how they are packed into the desnaon array.  
Example:  
-- copy 4 bytes to the destination array in opposite order  
format = array.compile("#4,#3,#2,#1")  
dest_array = array.repack(format, src_array)  
-- this corresponds to  
dest_array[1] = src_array[4]  
dest_array[2] = src_array[3]  
dest_array[3] = src_array[2]  
dest_array[4] = src_array[1]  
The format allows constant values in addion:  
4.02.0332.20002 Version 1.5  
Page 17 of 20  
GeneralDetails
NameHMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
MakeHMS NETWORKS
LanguageEnglish
FiletypePDF (Download)
File size MB
Download PDF
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

If you have any questions regarding HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide, please ask here and describe the problem in detail.

Leave a Reply

Your email address will not be published. Required fields are marked *

3 × four =

HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide