[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] lua-pb Lua Protocol Buffers
- From: "Robert G. Jakabosky" <bobby@...>
- Date: Thu, 23 Jun 2011 05:44:38 -0700
Announcing lua-pb [1] a Lua implementation of Google's Protocol Buffers [2].
What are protocol buffers?
Protocol buffers are a flexible, efficient, automated mechanism for
serializing structured data – think XML, but smaller, faster, and simpler. You
define how you want your data to be structured once, then you can use special
generated source code to easily write and read your structured data to and
from a variety of data streams and using a variety of languages.
lua-pb uses LPeg for parsing .proto [3] definition files and dynamically
generates message objects from the message definition. The encoder/decoder
code uses modules 'struct' [4] & Lua BitOp [5].
One of the main features that separates lua-pb from the other two
implementations [6] of Protocol Buffers for Lua, is that it doesn't require
static compiling of message definitions to native code. lua-pb dynamically
compiles message definitions at runtime.
See the test_media.lua [7] script for an example on how to use lua-pb.
Also lua-pb is designed with a flexible backend so a specialized backend can
be created for LuaJIT to make encoding/decoding faster. I haven't benchmarked
the current backend, but it should be reasonably efficient.
1. https://github.com/Neopallium/lua-pb
2. http://code.google.com/apis/protocolbuffers/docs/overview.html
3. https://github.com/Neopallium/lua-pb/blob/master/protos/media.proto
4. http://www.inf.puc-rio.br/~roberto/struct/
5. http://bitop.luajit.org/
6. http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns
7. https://github.com/Neopallium/lua-pb/blob/master/tests/test_media.lua
--
Robert G. Jakabosky