Namespace: bits

The bits namespace contains functions that are used for bits/bytes packing and unpacking.

You can access this namespace via:

ashita.bits.

Below are the functions available in this namespace.


ashita.bits.unpack_be

Unpacks bit data. (Big Endian)

function ashita.bits.unpack_be(data, offset, len);

Parameters

  • data - (string) The string to unpack the data from. (Mainly used with packet events.)
  • offset - (number) The offset of the data to unpack.
  • len - (number) The length of the data to unpack.

Returns

  • number - The unpacked value.

function ashita.bits.unpack_be(data, byteOffset, bitOffset, len);

Parameters

  • data - (string) The string to unpack the data from.
  • byteOffset - (number) The offset of the data to unpack.
  • bitOffset - (number) The bit offset of 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)

function ashita.bits.unpack_le(data, offset, len);

Parameters

  • data - (string) The string to unpack the data from. (Mainly used with packet events.)
  • offset - (number) The offset of the data to unpack.
  • len - (number) The length of the data to unpack.

Returns

  • number - The unpacked value.

function ashita.bits.unpack_le(data, byteOffset, bitOffset, len);

Parameters

  • data - (string) The string to unpack the data from.
  • byteOffset - (number) The offset of the data to unpack.
  • bitOffset - (number) The bit offset of data to unpack.
  • len - (number) The length of the data to unpack.

Returns

  • number - The unpacked value.