fuwaneko / node-protobuf

Google Protocol Buffers wrapper for Node.js [UNMAINTAINED]
181 stars 42 forks source link

important #85

Closed ghost closed 7 years ago

ghost commented 7 years ago

I get enum by proto file::

enum ERequestTypes{ ELoginCmd=0; }

message RequestMessage { ERequestTypes Type = 1 [default = ELoginCmd]; }

var obj = {Type: 'ELoginCmd' }; var ser = protoParse.serialize(obj, 'RequestMessage'); var parse = protoParse.parse(ser, 'RequestMessage');

I by the above step get the result:: parse.Type ==>"ELoginCmd" but I want get "parse.Type ==>0 " How I should do what??

fuwaneko commented 7 years ago

Sorry, I do not speak Chinese.

ghost commented 7 years ago

I change the answer to English

fuwaneko commented 7 years ago

@mengxiang1 enum values are always returned as strings. You have to convert them to numeric values manually.

ghost commented 7 years ago

I change the src code in my local PC. I am ok;