LuaRocks 是lua模块管理工具,官方网站:https://luarocks.org/

安装

Unix 系统安装

  1. $ wget https://luarocks.org/releases/luarocks-3.3.1.tar.gz
  2. $ tar zxpf luarocks-3.3.1.tar.gz
  3. $ cd luarocks-3.3.1
  4. $ ./configure && make && sudo make install
  5. $ sudo luarocks install luasocket
  6. $ lua
  7. Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
  8. > require "socket"

mac os 安装方式

  1. $ brew install luarocks
  2. ==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles/luarocks-3.4.0.catalina.bottle.tar.gz
  3. ######################################################################## 100.0%
  4. ==> Pouring luarocks-3.4.0.catalina.bottle.tar.gz
  5. ==> Caveats
  6. LuaRocks supports multiple versions of Lua. By default it is configured
  7. to use Lua5.3, but you can require it to use another version at runtime
  8. with the `--lua-dir` flag, like this:
  9. luarocks --lua-dir=/usr/local/opt/lua@5.1 install say
  10. ==> Summary
  11. 🍺 /usr/local/Cellar/luarocks/3.4.0: 104 files, 704.5KB