Module binary
-read and write (little endian) binary.
- located in mtul.binary
.
implements core dependencies and tools, especially for the MTUL libraries.
-reading binary inputs
-read_single (function) | -read an IEEE 754 single precision (32-bit) floating point number | +binary | +read and write (little endian) binary. |
read_double (function) | -read an IEEE 754 double-precision (64-bit) floating point number | -||
read_uint (function, int) | -read an unsigned integer of any given length | -||
read_uint (function, int) | -read a signed integer of any given length | +paths | +mod utilities +find the paths + find mod information |
misc binary helpers
-fround (number) | -"returns nearest 32-bit single precision float representation of a number" (or something) | -
expected function inputs
-read_byte () | -read_byte is a param name which refers to a function which reads the next byte- returning a whole number between 0-255. |
-
write_byte () | -write_byte is similar to read_byte, however it is given an input and expected to write it to the file. |
-
-
- - -
reading binary inputs
- -read_byte
function.
- -
-
- - - read_single (function) - -
-
- read an IEEE 754 single precision (32-bit) floating point number
-
-
-
Parameters:
--
-
- function - read_byte - -
- - - - read_double (function) - -
-
- read an IEEE 754 double-precision (64-bit) floating point number
-
-
-
Parameters:
--
-
- function - read_byte - -
- - - - read_uint (function, int) - -
-
- read an unsigned integer of any given length
-
-
-
Parameters:
--
-
- function - read_byte - -
- int - length in bytes of unsigned integer - -
- - - - read_uint (function, int) - -
-
- read a signed integer of any given length
-
-
-
Parameters:
--
-
- function - read_byte - -
- int - length in bytes of integer - -
-
misc binary helpers
- --
-
- - - fround (number) - -
-
- "returns nearest 32-bit single precision float representation of a number" (or something)
-
-
-
Parameters:
--
-
- number - - - - -
Returns:
--
-
- nearest 32-bit single precision float representation of a number
-
-
expected function inputs
- -read_byte
or write_byte
function as inputs
- -
-
- - - read_byte () - -
-
-
-
- -read_byte
is a param name which refers to a function which reads the next byte- returning a whole number between 0-255.
- - - - -function byte() - left = left - 1 - return assert(file_handle:read(1):byte()) - --reads the next chracter, and converts it to a "numerical code" using string.byte() - --it's important that this function moves forward in the file stream (as :read(1) does) -end -
Returns:
--
-
- a bytecode (an int between 0 and 255.)
-
- - - - write_byte () - -
-
-
write_byte
is similar to read_byte, however it is given an input and expected to write it to the file. - (example needed) - - - - - - - -
-