3

I tried to follow the example at 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 ?
> 

What am I missing?

Russell
  • 2,692
  • 5
  • 23
  • 24
  • 1
    Did you actually [download and install it](http://www.keplerproject.org/luasql/index.html#download)? – voithos Jun 01 '12 at 17:48
  • To use Postgres you need to install Postgress, SQLLite dll is normally included and can be used directly – Jane T Jun 01 '12 at 17:53
  • postresql is installed and luasql-postgres is installed with the proper paths to PGSQL_DIR and PGSQL_INCDIR – Russell Jun 01 '12 at 17:57
  • 3
    In Lua 5.2, `require` no longer defines globals. You need to save its return value as in @losinggeneration's answer. – lhf Oct 11 '12 at 20:51

1 Answers1

9

You could try

luasql = require "luasql.postgres"
env = assert (luasql.postgres())
andrewsi
  • 10,807
  • 132
  • 35
  • 51