Reference
pack( data )
Serialize a data
.
unpack( str )
Deserialize a string.
unpacker( stream )
Accept a string or an object which has a method read
,
like file
and returns a iterator.
The iterator gives a couple of values, the interesting value is the second.
set_number( str )
Configures the behaviour of pack
.
The valid options are double
, float
and integer
.
The default is usually double
.
set_integer( str )
Configures the behaviour of pack
.
The valid options are signed
and unsigned
.
The default is signed
.
Examples
local mp = require 'MessagePack' mp.set_number'float' mp.set_integer'unsigned' mpac = mp.pack(data) data = mp.unpack(mpac) f = io.open('file', 'r') for _, v in mp.unpacker(f) do print(v) end f:close()