jinjiazhang/protolua

How to use protolua

Opened this issue · 3 comments

Hi!
I have read that this package does not generate code.
(A) Isn't it supposed to generate setters, getters, and other methods, written in Lua?
(B) If (A) is true, can you make an example that starts from a proto message and finishes at the final program using the generated methods?
(C) If (A) is false, then how to use protolua?
Thanks,
Chuck

I have just found an example.lua.
It seems like there are no setters and getters.
I'll wait for your response on (A), (B) and (C).
Thanks,
Chuck

I apologize for the late reply to this issue. It does not need to generate setter and getter methods. It directly parses the proto protocol file using proto.parse("person.proto") and reads the message structure into memory. It calls proto.encode("Person", person) to serialize the Lua person table into binary data of Person type and calls proto.decode("Person", data) to deserialize binary data into a Lua table. In protolua, Lua tables and protobuf messages are directly associated. --Translated by ChatGPT

You need to match the keys of the Lua table with the field names of the message one by one. --Translated by ChatGPT