Skip to content

通过cjson序列化pb.decode中空数组的问题 #197

@doudouliyougangbeng

Description

@doudouliyougangbeng

由于lua中没有数组概念,pb.decode会把空数组当成空table,当cjson进行decode时就会序列化为{}。
现在cjson支持cjson.decode_array_with_array_mt(true)即当setmetatable({}, array_mt)时就会序列化[]。
我现在的做法为,递归所有属性,找到"repeated"的空table,进行设置
image
这种感觉非常不友好而且严重影响性能,有没有从pb方面就能很好的解决问题的方法呢?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions