This shows you the differences between two versions of the page.
addons:functions:bits [2017/04/21 20:48] atom0s created |
addons:functions:bits [2017/04/22 00:10] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Bits Namespace ===== | ||
- | The bits namespace contains functions that interact with bits and bytes data. | ||
- | |||
- | You can access these functions via: | ||
- | <code lua>ashita.bits.</code> | ||
- | |||
- | ---- | ||
- | ==== ashita.bits.unpack_be ==== | ||
- | |||
- | Unpacks bit data. (Big Endian) | ||
- | <code lua>number ashita.bits.unpack_be(data, offset, len);</code> | ||
- | * **Parameters** | ||
- | * data - (string) The string to unpack data from. | ||
- | * offset - (number) The offset of the data to unpack. | ||
- | * len - (number) The length of the data to unpack. | ||
- | * **Returns** | ||
- | * number - The unpacked value. | ||
- | |||
- | <code lua>number ashita.bits.unpack_be(data, byteOffset, bitOffset, len);</code> | ||
- | * **Parameters** | ||
- | * data - (string) The string to unpack data from. | ||
- | * byteOffset - (number) The byte offset of the data to unpack. | ||
- | * bitOffset - (number) The bit offset of the data to unpack. | ||
- | * len - (number) The length of the data to unpack. | ||
- | * **Returns** | ||
- | * number - The unpacked value. | ||
- | |||
- | ---- | ||
- | ==== ashita.bits.unpack_le ==== | ||
- | |||
- | Unpacks bit data. (Little Endian) | ||
- | <code lua>number ashita.bits.unpack_le(data, offset, len);</code> | ||
- | <code lua>number ashita.bits.unpack_le(data, byteOffset, bitOffset, len);</code> |