Skip to content

expose cursor_string

Endel Dreyer requested to merge endel/lua-MessagePack:patch-1 into master

I've managed to fix the issue I was having on #30 by using this:

local msgpack_cursor = {
    s = binary_string,
    i = 1,
    j = #binary_string,
    underflow = function() error "missing bytes" end,
}
local data = msgpack.unpack_cursor(msgpack_cursor)
msgpack_cursor.i -- this is the end of the msgpack-encoded message in the bytearray

My scenario:

I have a bytearray with multiple messages in it, not only MessagePack-encoded. And to allow parsing them with different methods, I could only determine where the messagepack bytes have ended through it's cursor's i number.

Edited by Endel Dreyer

Merge request reports