starwing / lua-protobuf

A Lua module to work with Google protobuf
MIT License
1.75k stars 387 forks source link

default不支持 #40

Closed xfanhsl closed 6 years ago

xfanhsl commented 6 years ago

assert(protoc:load [[ message Phone { optional string name = 1; optional int64 phonenumber = 2[default=0]; } message Person { optional string name = 1; optional int32 age = 2; optional string address = 3; repeated Phone contacts = 4; } ]])

error: function[lfdfd] parameter start: value: table value: table value: table value: table value: table value: table string: [script/protoc.lua:998: bad argument #2 to '?' (string expected at fiel d 'default_value', got number)] ----parameter end----

starwing commented 6 years ago

对,暂时不支持default,后续会提供支持

mink365 commented 6 years ago

这个功能挺重要的,我们也想要支持

starwing commented 6 years ago

好的,意见收到~目前的情况是proto2和3的default还不一样,支持还要写两份代码,而且影响性能Orz……准备最后不行的话还是用缓存元表的方法做算了……现在就看为了这个功能增加大概五百行代码是不是划算了……

xiaoxf commented 6 years ago

可以考虑先支持proto3的default?

starwing commented 6 years ago

嗯,是打算一起支持的~proto3更简单一点儿~不过最近没时间写= =

starwing commented 6 years ago

已经支持默认值功能了