gray
gray

Reputation: 327

why not a lua implementation of google's protocol buffers? is there already any better solution exist for lua?

why not a lua implementation of google's protocol buffers? is there already any better solution exist for lua?

Upvotes: 3

Views: 5102

Answers (3)

Neopallium
Neopallium

Reputation: 1458

I just created a Lua implementation of protocol buffers lua-pb. It dynamically loads/parsers .proto files to create message objects, so there is no dependence on the standard .proto compiler from Google.

It uses LPeg for parsing .proto files and struct & Lua BitOp for encoding/decoding.

Upvotes: 4

Josh Haberman
Josh Haberman

Reputation: 4210

I'm working on it as we speak: https://github.com/haberman/upb/wiki

Also, I'm the guy who wrote the 100-line parser above. But my upb library is much more full-featured.

Upvotes: 5

pib
pib

Reputation: 3313

Probably because a C or C++ implementation would be faster (and easier to write), and then you could hand the data off to Lua to be used if you want.

There's a 100 line C protocol buffer parser here: http://blog.reverberate.org/2008/07/12/100-lines-of-c-that-can-parse-any-protocol-buffer/

Or you could just use the Google C++ one, and then hand your data off to Lua from there.

Lua isn't built for bit twiddling, so perhaps that's why nobody has implemented protocol buffers in it yet. It doesn't even have bitwise operators built in: http://lua-users.org/wiki/BitwiseOperators

Upvotes: 2

Related Questions