Package: lua-protobuf
lua-protobuf provides a Lua interface to Google'sProtocol Buffers.Producing Codelua-protobuf provides a plugin for theprotocprotocol buffer compiler (it ships with protocol buffers). This plugin tellsprotocto produce a set of C++ output files, which define the Lua interface to protocol buffers using the Lua C API.First, obtain a copy of lua-protobuf:$ git clone git@github.com:indygreg/lua-protobuf.git
$ cd lua-protobufNext, install lua-protobuf:$ python setup.py installYes, lua-protobuf is written in Python (for now at least).Finally, launch protoc and tell it to produce Lua output:$ protoc -I/path/to/your/proto/files --lua_out=/output/path file1.proto file2.protoYou simply need to add--lua_outto the arguments toprotocto get it to produce the Lua output files.Under the hood,protocis looking for the programprotoc-gen-luasomewhere in your $PATH. You can modify $PATH in lieux of installing the package, if you desire.Missing plugin_pb2 Python ModuleThe protocol buffers Python installer does not install a file required by protoc-gen-lua at this time. The missing file is the Python interface to the compiler pluginplugin.proto. The protoc-gen-lua Python script may fail when importing thegoogle.protobuf.compiler.plugin_pb2module.A thread on the protocol buffers mailing listdiscusses the issue.At this time, the issue can be worked around by manually installing the missing file.Assuming you have a working protoc compiler on your system and have the existing Python protocol buffers package installed, from the protocol buffers source code directory, run the following:$ protoc -Isrc --python_out=/path/to/output/directory src/google/protobuf/compiler/plugin.protoThe command should produce no output if successful. Additionally, the file/path/to/output/directory/google/protobuf/compiler/plugin_pb2.pyshould have been created.Next, find the location of the installed protocol buffer Python package. If you havelocate, try finding it vialocate descriptor_pb2.py. A common location is something like/usr/lib/python2.6/site-packages/protobuf-2.3.0-py2.6.egg/google/protobuf/. Navigate to this directory and:$ mkdir compiler
$ touch compiler/__init__.py
$ cp /path/to/plugin_pb2.py compiler/plugin_pb2.pyIn common English:Create a new directory, from the install root,google/protobuf/compilerCreate an empty file,__init__.pyin this directory. This tells Python that the directory contains Python modules.Copy theplugin_pb2.pyfile produced by protoc to this new directory.Depending on the installed location of protocol buffers, these actions may require superuser or administrator privileges.Compiling Produced FilesYou should be able to compile the produced .h and .cc files like you would for protocol buffer output files. If you have an existing Makefile, project, etc, just add the produced .h and .cc files to it.For linking, you'll need to include whatever library contains Lua. On *NIX toolchains, this typically corresponds to the linker flag-lluaor-llua5.1.The produced C++ code containsextern "C" { }blocks around all code that utilizes Lua API function calls to avoid C++ name mangling.WindowsWindows requires an identifier for symbols to be exported from shared libraries. If compiling the lua-protobuf output to a shared library, you'll need to use a preprocessor define:#define LUA_PROTOBUF_EXPORT __declspec(dllexport)