Luasql and SQLite?

Posted by OverTheRainbow on Stack Overflow See other posts from Stack Overflow or by OverTheRainbow
Published on 2010-05-05T12:18:55Z Indexed on 2010/05/05 12:48 UTC
Read the original article Hit count: 257

Filed under:
|
|
|

Hello

I just got started looking at Lua as an easy way to access the SQLite DLL, but I ran into an error while trying to use the DB-agnostic LuaSQL module:

require "luasql.sqlite"
module "luasql.sqlite"

print("Content-type: Text/html\n")

print("Hello!")

Note that I'm trying to start from the most basic setup, so only have the following files in the work directory, and sqlite.dll is actually the renamed sqlite3.dll from the LuaForge site:

Directory of C:\Temp
<DIR> luasql
lua5.1.exe
lua5.1.dll
hello.lua

Directory of C:\Temp\luasql
sqlite.dll

Am I missing some binaries that would explain the error?

Thank you.


Edit: I renamed the DLL to its original sqlite3.dll and updated the source to reflect this (originally renamed it because that's how it was called in a sample I found).

At this point, here's what the code looks like...

require "luasql.sqlite3"

-- attempt to call field 'sqlite' (a nil value)
env = luasql.sqlite()

env:close()

... and the error message I'm getting:

C:\>lua5.1.exe hello.lua
lua5.1.exe: hello.lua:4: attempt to call field 'sqlite' (a nil value)

© Stack Overflow or respective owner

Related posts about lua

Related posts about Windows