pbc icon indicating copy to clipboard operation
pbc copied to clipboard

Lua5.1使用pbc解析int64返回是number type

Open chuang39 opened this issue 8 years ago • 4 comments

在openresty里使用pbc decode protobuf int64, 因为默认的是lua5.1,返回的值时number,看了看源代码没有很清楚头绪,请云哥指教如何使返回是2个int或8个byte?还有如果要生成protobuf int64类型如何解决?谢谢!

chuang39 avatar Jul 28 '16 22:07 chuang39

我试图使用parser去读proto file,但有如下错误 init_worker_by_lua error: /opt/openresty/lualib/parser.lua:53: syntax error at realtime-bidding.proto。 对应的proto是 https://developers.google.com/ad-exchange/rtb/downloads/realtime-bidding-proto

上面的问题是用pb.register_file("realtime-bidding.pb")见到的。请问pb file会保存正确的protobuf field type (e.g. int64)吗?还有想问一下从.proto file产生.pb file的方法。谢谢!

chuang39 avatar Jul 28 '16 23:07 chuang39

需要自己修改源代码,或者使用 lua 5.3 。这个项目除了修改 bug ,不打算维护。

cloudwu avatar Jul 29 '16 01:07 cloudwu

好,谢谢!

chuang39 avatar Jul 29 '16 01:07 chuang39

自己的项目话 只能把长整型改为字符串,

lilien1010 avatar Aug 24 '16 02:08 lilien1010