lua-resty-struct
convert between binary and lua, based on luajit. used for network protocol
$ opm get xiaooloong/lua-resty-struct
Resty Struct
convert between binary and lua, based on luajit.
just use like [struct][1] 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
[1]: https://docs.python.org/2/library/struct.html
Authors
xiaooloong
License
2bsd
Dependencies
luajit
Versions
-
convert between binary and lua, based on luajit. used for network protocol 2017-09-18 15:07:17