pbc icon indicating copy to clipboard operation
pbc copied to clipboard

about 'optional' field .

Open dhb118 opened this issue 10 years ago • 2 comments

the message like this: message Role{ optional int32 fieldA = 1; }

i got message from server, but server didn't packed 'fieldA' everytime . so how did know if 'fieldA' exist by lua code ?

dhb118 avatar Jan 08 '15 09:01 dhb118

FieldA has a type int32, it must be a value with this type any time. If the value equal the default value, the implemention would not encode it.

read the document of google protocol buffers for more detail.

发自我的 iPad

在 2015年1月8日,下午5:19,dhb118 [email protected] 写道:

the message like this: message Role{ optional int32 fieldA = 1; }

i got message from server, but server didn't packed 'fieldA' everytime . so how did know if 'fieldA' exist by lua code ?

— Reply to this email directly or view it on GitHub.

cloudwu avatar Jan 08 '15 11:01 cloudwu

thanks @cloudwu

dhb118 avatar Jan 08 '15 11:01 dhb118