LuaRocks - Binary Latest Windows-32.zip - https://luarocks.github.io/luarocks/releases/
- 下载二进制程序
- 解压
- 配置PATH
- 安装 Mingw - 包含gcc,用于编译源码
- 安装 Lua for windows
其中 MSYS2 (GCC) 的安装:
- 确保先安装 MSYS2
- 打开 MSYS2 UCRT64
- 安装 C / C++ Compiler
pacman -S mingw-w64-ucrt-x86_64-gcc- 检查版本 - GCC / mingw-w64:
1
2
3
4$ pacman -Qi mingw-w64-ucrt-x86_64-gcc | grep Version
Version : 15.2.0-8 # GCC Version
$ pacman -Qi mingw-w64-ucrt-x86_64-headers | grep Version
Version : 13.0.0.r354.g40ab95d18-1 # mingw-w64 Version
构建代码:
1 | // hello.c |
gcc hello.c -o hello.exe
测试代码:
1 | ./hello.exe |
Proxy Settings:
https://github.com/luarocks/luarocks/blob/main/docs/luarocks_through_a_proxy.md
1 | set http_proxy=http://server:1234 |
Github Protocol Fix:
git config --global url."https://github.com/".insteadOf git://github.com/
Using LuaRocks:
https://github.com/luarocks/luarocks/blob/main/docs/using_luarocks.md
Use 5.1:
luarocks config lua_version 5.1
see: C:\Users\Administrator\AppData\Roaming\luarocks
.vscode/settings.json:
1 | { |
luarocks:
1 | luarocks init |
.luarocks/config-5.1.lua
1 | variables = { |
.luarocks/default-lua-version.lua
1 | return "5.1" |
package路径调试
1 | for p in package.path:gmatch("[^;]+") do print(" " .. p) end |
注意,部分老包体按照luarocks2规则编写,不符合luarocks3规范,引入后可能会有问题。
(通常和require路径相关)