【问题标题】:luasql nil valueluasql 零值
【发布时间】: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 ?
> 

我错过了什么?

【问题讨论】:

  • 你真的download and install it吗?
  • 使用Postgres需要安装Postgress,SQLLite dll一般是自带的,可以直接使用
  • postresql 已安装,luasql-postgres 已安装,并带有指向 PGSQL_DIR 和 PGSQL_INCDIR 的正确路径
  • 在 Lua 5.2 中,require 不再定义全局变量。您需要将其返回值保存为@losinggeneration 的答案。

标签: lua luasql


【解决方案1】:

你可以试试

luasql = require "luasql.postgres"
env = assert (luasql.postgres())

【讨论】:

    猜你喜欢
    • 2012-12-25
    • 2015-12-16
    • 2018-11-29
    • 2018-01-28
    • 2019-06-17
    • 1970-01-01
    • 2017-08-28
    • 2017-08-26
    相关资源
    最近更新 更多