report one bug for enum in protoc-gen-lua script
movebean opened this issue · 0 comments
I report one bug for enum auto generate in protoc-gen-lua script.
proto file:
message RegisterReq {
enum CmdId
{
CMD_ID = 1;
}
optional ......
}
example:
module.REGISTERREQ_CMDID_CMD_ID_ENUM = protobuf.EnumValueDescriptor()
module.REGISTERREQ_CMDID_CMD_ID_ENUM.name = 'CMD_ID'
module.REGISTERREQ_CMDID_CMD_ID_ENUM.index = 0
module.REGISTERREQ_CMDID_CMD_ID_ENUM.number = 1
module.REGISTERREQ_CMDID.values = {REGISTERREQ_CMDID_CMD_ID_ENUM} // error
//should be
module.REGISTERREQ_CMDID.values = {module.REGISTERREQ_CMDID_CMD_ID_ENUM}
I am not very sure how to fix this gracefully
in protoc-gen-lua script 249 code_gen_enum_item function
I just change return value from
return obj_name
to
return 'module.' + obj_name
and It works