sean-lin/protoc-gen-lua — pull request #6 by krestenkrab (2014-05-03 08:22:04+00:00)
Title: fix problem with top-level field names

I tried to add an address to person, thus:

````
message Person {
required int32 id = 1;
required string name = 2;
optional string email = 3;
repeated Address addresses = 4;

extensions 10 to max;
}

message Address {
required string street = 1;
}
````

running protoc on this resulted in a problem, because the `addresses` field in the generated code looked thus; notice the `message_type` is wrong.

````lua
PERSON_ADDRESSES_FIELD.name = "addresses"
PERSON_ADDRESSES_FIELD.full_name = ".Person.addresses"
PERSON_ADDRESSES_FIELD.number = 4
PERSON_ADDRESSES_FIELD.index = 3
PERSON_ADDRESSES_FIELD.label = 3
PERSON_ADDRESSES_FIELD.has_default_value = false
PERSON_ADDRESSES_FIELD.default_value = {}
PERSON_ADDRESSES_FIELD.message_type = DDRESS
PERSON_ADDRESSES_FIELD.type = 11
PERSON_ADDRESSES_FIELD.cpp_type = 10
````

The problem seem to be that top-level message types get generated wrong, and this patch fixes that.

I have not done extensive testing, so the fix may cause other problems.