Module el.bytes
Manage raw byte arrays.
Info:
- Author: Michael Fisher
Functions
new (size) | Create a new byte array. |
free (bytes) | Free used memory. |
get (bytes, index) | Get a byte from the array. |
set (bytes, index, value) | Set a byte in the array. |
size (bytes) | Returns the size in bytes. |
pack (b1, b2, b3, b4) | Pack 4 bytes in a 64bit integer. |
Functions
- new (size)
-
Create a new byte array.
Parameters:
- size integer Size in bytes to allocate
Returns:
-
kv.ByteArray
The new byte array.
- free (bytes)
-
Free used memory.
Parameters:
- bytes The array to free
- get (bytes, index)
-
Get a byte from the array.
Parameters:
- bytes Bytes to get from
- index integer Index in the array
- set (bytes, index, value)
-
Set a byte in the array.
Parameters:
- bytes Target bytes
- index integer Index in the array
- value integer Value to set in the range 0x00 to 0xFF inclusive
- size (bytes)
-
Returns the size in bytes.
Parameters:
- bytes Target bytes
Returns:
-
int
The size in bytes.
- pack (b1, b2, b3, b4)
-
Pack 4 bytes in a 64bit integer.
Undefined params are treated as zero
Parameters:
- b1 integer First byte
- b2 integer Second byte
- b3 integer Third byte
- b4 integer Fourth byte
Returns:
-
int
Packed lua_Integer