lua-pb icon indicating copy to clipboard operation
lua-pb copied to clipboard

Cannot encode/decode a negative int32

Open jbrophy60 opened this issue 7 years ago • 0 comments

int32.proto:

message TestInt32 { optional int32 int32_ = 1; }

The following test fails when value is a negative number:

local pb = require"pb" local value = -1 local integer32 = require"int32"

local msg = integer32.TestInt32() msg.int32_ = value; binary,err = msg:Serialize(); assert(not err)

local decoded = integer32.TestInt32():Parse(binary) assert(decoded:IsInitialized()) assert(decoded:HasField('int32_')) assert(value == decoded.int32_)

(similar to #35 )

jbrophy60 avatar May 31 '18 13:05 jbrophy60