MAC OS
安裝 luarocks
brew install luarocks
本機默認 lua 版本爲 5.3,可通過 --lua-dir 選擇需要安裝的版本
安裝 luasocket
luarocks install luasocket
安裝mysql、postgres
brew install mysql
brew install postgres
安裝 luasql-mysql、luasql-postgres
luarocks install luasql-mysql MYSQL_INCDIR=/usr/local/Cellar/mysql/8.0.18_1/include/mysql/
luarocks install luasql-postgres PGSQL_DIR=/usr/local/Cellar/postgresql/12.1/
驗證
> local mysql = require "luasql.mysql"
>
> local postgres = require "luasql.postgres"
>