[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: unable to load lsqlite3
- From: Ross Berteig <Ross@...>
- Date: Wed, 3 Aug 2016 17:46:39 -0700
On 8/3/2016 1:44 PM, Weinstein, Jay wrote:
I’m new to lua and I can’t seem to figure out how to get around the
following problem.
....
local table = require("sqlite3")
stdin:1: module 'sqlite3' not found:
no field package.preload['sqlite3']
no file 'C:\Program Files (x86)\Lua\5.1\sqlite3.lua'
no file
'C:\Users\Jay.Weinstein\Downloads\Binaries-LuaDist-batteries-0.9.8-Windows-x86\lib\lua\5.1\luasql'
....
It looks like you are trying to use the SQLite3 driver for LuaSQL. The
documented approach is to load it as a sub-module:
local luasql = require "luasql.sqlite3"
The luasql table that is loaded will have a single function named
luasql.sqlite() that creates and returns a database environment object
through which you do everything else.
One pitfall you've set up for yourself is in your line
local table = require("sqlite3")
There is already a global variable named table. It is one of the several
libraries that are always loaded by the default lua executable (but are
optional if you are opening a lua interpreter in your own host
executable). Replacing any of those libraries with something completely
unrelated will eventually lead to madness.
I’ve added
C:\Users\Jay.Weinstein\Downloads\Binaries-LuaDist-batteries-0.9.8-Windows-x86\lib\lua\5.1\luasql
to lua_cpath and lua_path and sqlite3.dll is in thhe luasql directory.
You should add
C:\Users\Jay.Weinstein\Downloads\Binaries-LuaDist-batteries-0.9.8-Windows-x86\lib\lua\5.1
to LUA_CPATH and LUA_PATH. That way the database driver module will be
properly found as a sub-module.
--
Ross Berteig Ross@CheshireEng.com
Cheshire Engineering Corp. http://www.CheshireEng.com/
+1 626 303 1602