Start. Py export_pb_lua execution. Excute (protoName)
Call protoc-gen-lua.bat and pass in parameters,
This is simply the path to the various path parameters and the [second step] table_xxx. proto file path constructed by data type and data name
The output path of the LUa version PB file. If the ret is true, the generation is successful.
The final output path I wrote was Temp/PB_Lua, named table_xxx_pb.lua
This lua file can be directly used in Unity project lua version of pb, at the end of the tool only need to copy all files Temp/PB_Lua folder into the project.
cmd = "{}\protoc-gen-lua.bat {} {} {} {}\Table_{}.proto".format( os.path.abspath(setting.protocPath_lua), os.path.abspath(setting.dirPath_proto), os.path.abspath(setting.dirPath_protoEnum), os.path.abspath(setting.dirPath_pb_lua), os.path.abspath(setting.dirPath_proto), System (CMD) if(not ret): debug.throwError("{} Failed to generate python pb =>\n{}". Format (protoName, MSG))Copy the code
For now, these paths must be passed in a fixed order, such as the proto path and the path that you want to output the LUa version of pb. If you want to change it, change the source code of the protoc-gen-Lua tool
Protoc -gen-lua.bat generates luA pb files