lua-pb
lua-pb copied to clipboard
Cannot encode/decode a negative int32
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 )