为什么不使用 lua 实现 google 的协议缓冲区呢? lua有没有更好的解决方案?

发布于 2024-08-18 15:05:39 字数 51 浏览 1 评论 0原文

为什么不使用 lua 实现 google 的协议缓冲区呢? lua有没有更好的解决方案?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

如何视而不见 2024-08-25 15:05:39

正如我们所说,我正在努力: https://github.com/haberman/upb/wiki

另外,我我就是上面那个写了 100 行解析器的人。但我的 upb 库功能更齐全。

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.

那一片橙海, 2024-08-25 15:05:39

我刚刚创建了一个协议缓冲区的 Lua 实现 lua-pb。它动态加载/解析 .proto 文件来创建消息对象,因此不依赖于 Google 的标准 .proto 编译器。

它使用 LPeg 来解析 .proto 文件和 结构 & Lua BitOp 用于编码/解码。

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.

禾厶谷欠 2024-08-25 15:05:39

可能是因为 C 或 C++ 实现会更快(并且更容易编写),然后您可以根据需要将数据交给 Lua 来使用。

这里有一个 100 行 C 协议缓冲区解析器: http://blog.reverberate.org/2008/07/12/100-lines-of-c-that-c​​an-parse-any-protocol-buffer/

或者你可以只使用 Google C++,然后将你的数据从那里交给 Lua。

Lua 并不是为了处理位操作而构建的,所以也许这就是为什么还没有人在其中实现协议缓冲区的原因。它甚至没有内置按位运算符: http://lua-users.org/wiki/BitwiseOperators

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文