protoc-gen-lua icon indicating copy to clipboard operation
protoc-gen-lua copied to clipboard

Does it suppot UINT64?

Open crazytom1988 opened this issue 11 years ago • 2 comments

I saw in the "descriptor.lua" that there were TYPE_UINT64 and CPPTYPE_UINT64 in the file.

Now i define a uint64 field named id in a .proto file and gen a _pb.lua file. How can i use the filed? I write a testcase: print(type(xxx.id)) the result is still "number". Lua's number is a double value. It can't hold a uint64 variable.

crazytom1988 avatar Apr 09 '14 06:04 crazytom1988

I just reviewed the code for this, and indeed it does not support the xx64 types. The current implementation will only pass the lower ~48 bits of the integer as a fixed64, and the lower 32bit of the the integer when using zigzag encoding. Perhaps depend on something like https://gist.github.com/stevedonovan/6146474

krestenkrab avatar May 08 '14 12:05 krestenkrab

@krestenkrab that's the problem of lua. I think I will fix it when lua 5.3 released. http://www.lua.org/work/doc/ support for integers (64-bit by default)

sean-lin avatar May 09 '14 01:05 sean-lin