Would this work?
function addmodulepath(path)
-- add to package paths (if not already present)
if not string.find(package.path, path, 0, true) then
package.path = string.format("%s/?.lua;%s", path, package.path)
package.path = string.format("%s/?/init.lua;%s", path, package.path)
package.cpath = string.format("%s/?.dll;%s", path, package.cpath)
end
end
On Thu, Dec 31, 2009 at 9:07 AM, Luciano de Souza
<luchyanus@predialnet.com.br> wrote:
Hello listers,
I'm embedding a Lua script in a Pascal program. The script calls
functions
from LuaSQL, consequently, the respective DLLs must be available. I could
place then in the current directory, but regarding that I have 48 further
DLLs related to IUP, to concentrate everything in the current directory
is
not a good idea. So I want to create one directory pur application and
place
all the necessary libraries in a separated path. But how to do it?
I tried the more obvious solution, adding the libraries' folder to the
Windows path. Surprisely, this procedure didn't work! The programs only
can
be executed if the libraries are all present in the current directory.
For
this reason, I ask:
1. How can I add a path to a Lua script allowing it to find the necessary
DLLs in a folder different from the current one?
2. Is this procedure equals for static libraries, in other words, for
another scripts called by "require"?