decode_format specification

The format string consists of a set of characters which indicate the type of argument for each relative position.

The format characters for the encode function are:
a fixed width string, right padded with NULLs
Afixed width string, right padded with spaces
Bbignum (encoded as a null terminated string)
ddouble (8 bytes) 
hshort (2 bytes, -32768 through 32767)) 
Hunsigned short (2 bytes, 0 through 65535) 
iinteger (4 bytes, -2147483648 through 2147483647) 
Iunsigned integer (4 bytes, 0 through 4294967295) 
llong long (8 bytes) 
Lunsigned long long (8 bytes) 
Nfixed width number (ascii encoded) 
pposition within the string (only valid for decode) 
vvariable length binary string up to 65535 bytes 
Vvariable length binary string up to 4294967295 bytes 
ybyte (-128 through 127) 
Yunsigned byte (0 through 255) 
Znull terminated string

Modifiers
>	encode number using big endian format

<	encode number using little endian format

For all format types other than A and N, a number can be specified after the format character to repeat that type some number of times.

The A and N options behaves differently from the other options. Both will always only generate or consume a single fixed-width input value. For the fixed length formats A and N, the encode function truncate the value if it is larger than the specified width of the field.

Format 'i10' means 10 integers whereas format 'A10' means one fixed-width string that is 10 characters wide. 'N5' means a fixed-width table.maxndecnumber that is 5 characters wide.

The l and L (long long) formats only support 53 bits of information due to Lua's number format being a double which uses 53 bits to store the number and 11 bits to store the exponent.

The < and > operators apply to a single format character. The format string 'i>ii<' encodes the first integer using big endian, the second using native encoding (the default), and the third number using little endian format. The format string 'i10>' indicates to encode 10 integers using big endian format.