Byte arrays are used to control packets and are a lua recreation of the ByteStrings.
Parameter Type Required Description stack table
✕ An array of bytes. Creates a new instance of a Byte Array. Alias:
byteArray()
.Returns:
Type Description byteArray
The new Byte Array object. Table structure:
{ stack = { }, -- The bytes stack stackLen = 0 -- Total bytes stored in @stack }
Parameter Type Required Description quantity int
✔ The quantity of bytes to be extracted. (default = 1) Extracts bytes from the packet stack. If there are not suficient bytes in the stack, it's filled with bytes with value 0.
Returns:
Type Description table
,int
A table with the extracted bytes. If there's only one byte, it is sent instead of the table.
Extracts a short integer from the packet stack.
Returns:
Type Description int
A short integer.
Extracts a short signed integer from the packet stack.
Returns:
Type Description int
A short signed integer.
Extracts an integer from the packet stack.
Returns:
Type Description int
An integer.
Extracts a long integer from the packet stack.
Returns:
Type Description int
A long integer.
Extracts a long string from the packet stack.
Returns:
Type Description string
A long string.
Extracts a boolean from the packet stack. (Whether the next byte is 0 or 1)
Returns:
Type Description boolean
A boolean.
Extracts a string from the packet stack.
Returns:
Type Description string
A string.
Parameter Type Required Description ... int
✕ Bytes. (default = 0) Inserts bytes in the byte array.
Returns:
Type Description byteArray
Object instance.
Parameter Type Required Description short int
✔ An integer number in the range [0, 65535]. Inserts a short integer in the byte array.
Returns:
Type Description byteArray
Object instance.
Parameter Type Required Description int int
✔ An integer number in the range [0, 16777215]. Inserts an integer in the byte array.
Returns:
Type Description byteArray
Object instance.
Parameter Type Required Description long int
✔ An integer number in the range [0, 4294967295]. Inserts a long integer in the byte array.
Returns:
Type Description byteArray
Object instance.
Parameter Type Required Description utf table
,string
✔ A string/table with a maximum of 16777215 characters/values. Inserts a string in the byte array.
Returns:
Type Description byteArray
Object instance.
Parameter Type Required Description bool boolean
✔ A boolean. Inserts a byte (0, 1) in the byte array.
Parameter Type Required Description utf table
,string
✔ A string/table with a maximum of 65535 characters/values. Inserts a string in the byte array.
Returns:
Type Description byteArray
Object instance.