1、简介

该软件包可以安装和更新lua的第三方模块。

2、下载地址

请在 http://luarocks.org/releases/ 页面选择需要的软件包。

wget http://luarocks.org/releases/luarocks-2.1.0.tar.gz

3、安装

tar -zxvf luarocks-2.1.0.tar.gz

cd luarocks-2.1.0

./configure --prefix=/usr/local/luarocks

make build

make install

OK了,luarock的可执行文件被安装到了 /usr/local/luarocks/bin/luarocks.

4、使用(暂时把英文直接copy过来,有时间再翻译)

使用luarocks安装lua模块的示例:

luarocks install luasocket

luarocks install luasql-sqlite3

luarocks install lpeg

luarocks install lzlib

luarocks install luafilesystem

luarocks install luasec

luarocks install md5

luarocks install luacurl

luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql MYSQL_LIBDIR=/usr/lib64/mysql/ (mysql的各种路径自己locate去找吧 = = !)

luarocks install lua-cjson

1.模块安装后如果在程序require的时候提示找不到相应模块则可以在luarocks和lua之间做一个软链接:

例如安装完luasql-mysql之后可能在程序中require的时候会提示找不到模块,这时候我们可以:

cd /usr/local/lib/lua/5.1/

mkdir luasql

ln -s /usr/local/luarocks/lib/lua/5.1/luasql/mysql.so /usr/local/lib/lua/5.1/luasql/mysql.so

2.运行时提示attempt to index global 'luasql' (a nil value) 代码里面require "luasql.mysql"需要这样写

luasql = require "luasql.mysql"

最新文章

  1. windows 7 + virtualbox安装centos+mono+jexus
  2. Add Indexer to DynamicJson
  3. Winform开发主界面菜单的动态树形列表展示
  4. String类中的一些函数使用方法
  5. HttpHandler和ashx要实现IRequiresSessionState接口才能访问Session信息(转载)
  6. PL/SQL 游标的使用
  7. CodeForces 510E Fox And Dinner
  8. chrome开发工具指南(十三)
  9. gulp管理静态资源缓存
  10. 排序算法java实现
  11. 【BSGS】BZOJ3239 Discrete Logging
  12. php 删除一维数组中某一个值元素的操作方法
  13. String:字符串常量池
  14. artTemplate的使用案列
  15. python while for else
  16. Python3基础 pickle.dump和load 对一个对象进行序列化存储及读取
  17. docker on mac:误删default vm的处理方法
  18. 【python】格式化字符
  19. 洛咕 P2155 [SDOI2008]沙拉公主的困惑
  20. LoadRunner内部结构

热门文章

  1. jquery 中的回调函数,回调函数(callback)是什么?
  2. [BestCoder Round #5] hdu 4956 Poor Hanamichi (数学题)
  3. Java精选笔记_JSP技术
  4. 在properties.xml中定义变量,在application.xml中取值问题
  5. 使用命令wsimport构建WebService客户端
  6. C 环境设置(转自菜鸟教程)
  7. 什么是SQL注入式攻击和如何防范?
  8. 【Linux】 ftp 主动被动模式
  9. 【Linux系列】find命令使用
  10. html5实现的一些效果