Debian Codegraph @

test/functional/util/nn_unpack.lua

raw
1 local ucl = require "ucl"
2
3 local function unhex(str)
4 return (str:gsub('..', function (cc)
5 return string.char(tonumber(cc, 16))
6 end))
7 end
8
9 local parser = ucl.parser()
10 local ok, err = parser:parse_string(unhex(arg[1]), 'msgpack')
11 if not ok then
12 io.stderr:write(err)
13 os.exit(1)
14 end
15
16 print(ucl.to_format(parser:get_object(), 'json-compact'))