convert between binary and lua, based on luajit. OpenResty 网络协议基础库
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lualib/resty/struct
LICENSE
README-zh.md
README.md
dist.ini

README.md

Resty Struct

中文说明

convert between binary and lua, based on luajit.

just use like struct class of Python.

this module is still on developing and do not use it now.

example:

local struct = require 'resty.struct'

local binary, err = struct.pack('HHL', 1, 2, 3)

if not binary then print(err) end

local table, count = struct.unpack('HHL', binary)

if table then
    for i = 1, count do
        print(table[i])
    end
else
    print(count) -- error message instead
end