--- The Binary Data Library allows to pack and unpack to and from
-- binary data. Encoding and decoding works by using a format
-- string containing certain operator characters:
--
| Operator | Description |
-- | H | hex string |
-- | B | bit string |
-- | x | null byte |
-- | z | zero-terminated string |
-- | p | string preceded by 1-byte integer length |
-- | P | string preceded by 2-byte integer length |
-- | a | string preceded by 4-byte integer length |
-- | A | string |
-- | f | float |
-- | d | double |
-- | n | Lua number |
-- | c | char (1-byte integer) |
-- | C | byte = unsigned char (1-byte unsigned integer) |
-- | s | short (2-byte integer) |
-- | S | unsigned short (2-byte unsigned integer) |
-- | i | int (4-byte integer) |
-- | I | unsigned int (4-byte unsigned integer) |
-- | l | long (8-byte integer) |
-- | L | unsigned long (8-byte unsigned integer) |
-- | < | little endian modifier |
-- | > | big endian modifier |
-- | = | native endian modifier |
--
-- Note that the endian operators work as modifiers to all the
-- characters following them in the format string.
module "bin"
--- Packs values according to format string.
-- Note: on Windows packing of 64 bit values > 2^63 currently
-- results in packing exactly 2^63.
--@param format Format string, used to pack following arguments
--@return String containing packed data
function bin.pack(format, ...)
--- Unpacks values according to format string.
--@param format Format string, used to unpack values out of data string
--@param data String containing packed data
--@param init Optional starting position within the string
--@return First returned value is the position in the data string where unpacking stopped, following returned values are the unpacked values.
function bin.unpack(format, data, init)