starwing / lua-protobuf

A Lua module to work with Google protobuf
MIT License
1.71k stars 388 forks source link

关于pb.decode使用问题 #238

Open YvanWan opened 1 year ago

YvanWan commented 1 year ago

在使用pb.decode过程中,我得到报错: bad argument #2 to 'decode' (string/buffer/slice expected, got userdata) 数据是从go服务端传过来的byte[] 数据,我改如何构建成为 tring/buffer/slice类型?

StarlightIbuki commented 1 year ago

请更具体地描述类型。你需要获得 byte[] 的长度和首个元素的指针,然后用 ffi.string 转换到 Lua string.