lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I can't understand why, but unfortunately it didn't work. Let me show you the first lines of my script. In c:\arquivos de programas\iup are the DLL for IUP. Therefore, the program should be successfu in accesssing the libraries from another folder called c:\test where I have only the executable that fires the program and the script Lua calling the DLLs.

require('package')

path = 'c:\arquivos de programas\iup"

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

require('iuplua')

require('iupluacontrols')



----- Original Message ----- From: "Wesley Smith" <wesley.hoke@gmail.com>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Thursday, December 31, 2009 3:11 PM
Subject: Re: Adding new paths for the access of embedded programs


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"?