lua-users home
lua-l archive

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


I just realized that the LUA_PATH scheme works for .lua files only. require doesn't load .dll's. So you need to implement LUA_PATH search for loadlib, and for convenience put it in a common utils.lua file which you can require first. Like this:

local utils = require "utils"
local someCLib = utils.loadlib( "aTool/someCppLib" )
local anotherCLib = utils.loadlib( "aTool/anotherCLib", "loader_func" )

Something definitely must be added to Lua or the auxiliary libraries to ease module finding and loading...

Ivan


Tomas wrote:

	Hi Ivan,


Which seems simple enough. Then the only requirement that remains is to
install each tool in a folder with some fixed name, so each tool could
do
  require "tools/someTool"
or
  require "thisTool/subModule"
Of course, fixed names could possibly lead to name clashes, as we know,
but that should happen very rarely, and could be avoided by installing
different sets of tools into different subfolders, and adding each to
LUA_PATH.

	Yes.  But, adding "C:\Program Files\Lua\?\?.lua" (note the two '?')
to your LUA_PATH could provide a simple way to use libraries that load
other internal Lua files.  This way one could install a library like:

aTool\aTool.lua
     \auxiliar.lua
     \another.lua

	And load it with

require "aTool"

	The file aTool.lua would have to

require "aTool/auxiliar.lua"
require "aTool/another.lua"

	And it will work just with a correct LUA_PATH, despite the folder
where "aTool" subfolder was installed.
		Tomas