Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Lua binding of MessagePack
C++
branch: master
Failed to load latest commit information.
src Fixed to check the return value of luaL_newmetatable
.gitignore added .gitignore
AUTHORS Added AUTHORS, COPYING and README
COPYING Added AUTHORS, COPYING and README
ChangeLog mplua-0.2.0
Makefile.am Renamed README in Makefile.am
README.rst Renamed README
autogen.sh
configure.ac mplua-0.2.0

README.rst

MessagePack for Lua

Still writing...

Requirement

MessagePack for C++ and liblua 5.1 is required.

Install

Run ./configure && make && make install.

Usage

Serialization

require "msgpack"

-- pack accepts variable length arguments.
-- data is a string.
data = msgpack.pack(1, 2, 3, "strings", {"a", "r", "r", "a", "y", "s"},
                    {t = "a", b = "l", e = "s"; 1, 2, 3, 4})

Deserialization

Simple deserialization:

require "msgpack"
a, b, c = msgpack.unpack(msgpack.pack(1, 2, 3))
-- a == 1, b == 2, c == 3

ar = msgpack.unpackToArray(msgpack.pack(1, 2, 3))
-- ar[1] == 1, ar[2] == 2, ar[3] == 3

Stream deserialization:

require "msgpack"

u = msgpack.Unpacker()
u:feed(data)

for v in u do
  -- v has a serialized data
end
Something went wrong with that request. Please try again.