• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

calio/lua-capnproto: Lua-capnp is a pure lua implementation of capnproto based o ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

calio/lua-capnproto

开源软件地址(OpenSource Url):

https://github.com/calio/lua-capnproto

开源编程语言(OpenSource Language):

Lua 90.2%

开源软件介绍(OpenSource Introduction):

lua-capnproto

Cap’n Proto is an insanely fast data interchange format and capability-based RPC system.

Lua-capnproto is a pure lua implementation of Cap'n Proto based on LuaJIT.

This project is still under early development and is not production-ready.

Synopsis

Suppose you have a Cap'n Proto file called example.capnp. You can compile this file like this:

$capnp compile -olua example.capnp

The default output file is example_capnp.lua

local example_capnp = require "example_capnp"

Check out example/AddressBook.capnp and example/main.lua for how to use generated lua file.

Installation

To install lua-capnproto, you need to install Cap'n Proto http://kentonv.github.io/capnproto/install.html, LuaJIT http://luajit.org/install.html and luarocks http://luarocks.org/en/Download first.

Currently, lua-capnproto only works with LuaJIT v2.1. You can install LuaJIT v2.1 using the following commands:

$git clone http://luajit.org/git/luajit-2.0.git
$git checkout v2.1
$make && sudo make install
$sudo ln -sf luajit-2.1.0-alpha /usr/local/bin/luajit

Then you can install lua-capnproto using the following commands:

$sudo luarocks install lua-capnproto

Let's compile an example file to test whether lua-capnproto was installed successfully:

$capnp compile -olua proto/example.capnp proto/enums.capnp proto/lua.capnp proto/struct.capnp

Normally, you should see no errors and a file named "proto/example_capnp.lua" is generated.

How to use

Please see my blog post on how to use lua-capnproto here.

Testing

If you want to run unit tests, you need to install lunitx and lua-cjson:

$sudo luarocks install lua-cjson
$sudo luarocks install lunitx

If your Linux distribution have Lua 5.2 installed, using this instruction to install required lua modules.

To run tests:

$./test.sh

Limitations

  • Currently, lua-capnproto only works with LuaJIT v2.1. This is because lua-capnproto needs 64 bit integer support and 64bit number bit operations, but only LuaJIT v2.1 provides a decent way to do all these. I'm working on LuaJIT 2.0/ Lua 5.1 / Lua 5.2 support, hopefully you can use lua-capnproto with your favorite lua soon.
  • Cap'n Proto RPC is not implemented yet



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
alecchen/doxygen-lua: Make Doxygen support Lua发布时间:2022-08-16
下一篇:
skyhacker2/SnakeGameLua: 使用cocos2d-x lua编写的贪吃蛇小游戏发布时间:2022-08-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap