Skip to content

chronolaw/lua-resty-msgpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lua-resty-msgpack

Lua messagepack for ngx_lua/stream_lua/OpenResty

This is an opm wrapper for lua-MessagePack(But it is broken now)

Another choice is luajit-msgpack-pure, but it has a different API.

Installation

Please use opm, such as :

opm get chronolaw/lua-resty-msgpack

Usage

Basics

local mp = require "resty.msgpack"

local my_data = {this = {"is",4,"test"}}
local encoded = mp.pack(my_data)
local decoded = mp.unpack(encoded)

Concatenating encoded data

local mp = require "resty.msgpack"

local my_data_1 = 42
local my_data_2 = "foo"
local encoded = mp.pack(my_data_1) .. mp.pack(my_data_2)

for _,v in mp.unpacker(encoded) do
    ngx.say("unpack is ", type(v), " : ", v)
end

About

Lua messagepack for ngx_lua/stream_lua/OpenResty

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages