参考资料
http://dhq.me/luarocks-a-deployment-and-management-system-for-lua-modules
Luarocks是一个安装lua 模块的工具,在unbuntu下apt-get install luarocks即可安装。
如果想查询某个模块,例如查看提供json功能的模块,可以使用luarocks search json进行检索
icode0410@ubuntu:~/Documents/code/Lua/coroutine$ luarocks search json
Search results:
===============
Rockspecs and source rocks:
---------------------------
luajson
1.3.3-1 (rockspec) - http://luarocks.org/repositories/rocks
1.3.3-1 (src) - http://luarocks.org/repositories/rocks
lusty-json
0.3-3 (rockspec) - http://luarocks.org/repositories/rocks
0.3-2 (rockspec) - http://luarocks.org/repositories/rocks
0.3-1 (rockspec) - http://luarocks.org/repositories/rocks
0.3-0 (rockspec) - http://luarocks.org/repositories/rocks
0.3-0 (src) - http://luarocks.org/repositories/rocks
0.2-0 (rockspec) - http://luarocks.org/repositories/rocks
0.2-0 (src) - http://luarocks.org/repositories/rocks
0.1-1 (rockspec) - http://luarocks.org/repositories/rocks
0.1-0 (rockspec) - http://luarocks.org/repositories/rocks
Binary and pure-Lua rocks:
--------------------------
luajson
1.2-1 (all) - http://luarocks.org/repositories/rocks
1.1-1 (all) - http://luarocks.org/repositories/rocks
要安装某个模块时,使用luarocks install modulename即可。
模块默认被安装到luarocks 的rocks-tree配置目录(编译的时候可以指定)中
一些C动态链接库的目录
luarocks show json可以查看已安装的json相关的模块;
luarocks list 列出所有安装的模块
用起来挺方便,但是注意版本问题:本机lua5.2,结果安装的都是5.1模块,所以做了个ln -s 5.1 5.2,但是由于Lua5.1和5.2 api的差异,有些模块不能正常使用。