【发布时间】:2012-06-06 23:19:20
【问题描述】:
我尝试按照http://www.keplerproject.org/luasql/examples.html 的示例进行操作
Lua 5.2.0 Copyright (C) 1994-2011 Lua.org, PUC-Rio
> require "luasql.postgres"
> env = assert (luasql.postgres())
stdin:1: attempt to index global 'luasql' (a nil value)
stack traceback:
stdin:1: in main chunk
[C]: in ?
>
我错过了什么?
【问题讨论】:
-
使用Postgres需要安装Postgress,SQLLite dll一般是自带的,可以直接使用
-
postresql 已安装,luasql-postgres 已安装,并带有指向 PGSQL_DIR 和 PGSQL_INCDIR 的正确路径
-
在 Lua 5.2 中,
require不再定义全局变量。您需要将其返回值保存为@losinggeneration 的答案。