zifa2003293 发表于 2023-4-9 11:18

Unity tolua protobuf解析失败

Unity tolua protobuf解析失败

报错:invalid varint value at offset参考资料


报错:invalid varint value at offset

socket在C#,将解析的数据传给Lua有两种方式
用string的方式,Lua将收到的string数据直接使用pb.decode,如果proto中使用了repeated等较为复杂的数据会产生报错,解析失败用byte[]的方式,因为Lua没有byte,Lua收到的数据将会是一个userdata,无法直接传递给pb.decode,需要使用tolua.tolstring转化

参考资料

C# tolua 之间互传 byte[].
页: [1]
查看完整版本: Unity tolua protobuf解析失败