环境:
macOS Monterey 12.4
nginx version: openresty/1.19.9.1
LuaJIT 2.1.0-beta3
下载lsqlite3和luasql-sqlite3
luarocks install lsqlite3
lua文件中代码:
package.path = package.path .. string.format(";%s?.so", "/opt/homebrew/lib/lua/5.4/")
local sqlite3 = require("lsqlite3")
报错:
error loading module 'luasql.sqlite3' from file '/opt/homebrew/lib/lua/5.4/luasql/sqlite3.so':
/opt/homebrew/lib/lua/5.4/luasql/sqlite3.so:1: '=' expected
使用luasql.sqlite3组件也是一样的错误提示。
如果直接在终端执行是没问题的。
~ % lua
Lua 5.4.3 Copyright (C) 1994-2021 Lua.org, PUC-Rio
lsqlite3=require("lsqlite3")
lsqlite3.version()
3.38.5
lsqlite3=require("luasql.sqlite3")
lsqlite3.sqlite3()
SQLite3 environment (0x600001f801b8)