lua-users home
lua-l archive

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


David Burgess wrote:
> > #define LUA_ROOT	  "C:\\Program Files\\Lua51"
> > #define LUA_LDIR	  LUA_ROOT "\\lua"
> > #define LUA_CDIR	  LUA_ROOT "\\dll"
> I question the use of these strings.

Ok. Your solution to use a path relative to the executable certainly has
an appeal. Maybe we can generalize it and use a split scheme everywhere:
The prefix is derived via GetModuleFileName() for Windows and is a compile
time constant in luaconf.h for all other systems (e.g. "/usr/local/").

> I added to the default LUA_CPATH the subsitution character '#'
> (if you can suggest a better character please do). So we my
> default LUA_CPATH looks like.

lua_gsub works with arbitrary strings. What about "%PREFIX%"? Looks like
a readable and extensible convention.

> To use a package like Lua socket simply requires something like
> #define LUA_CPATH_DEFAULT "#l?;#?;#\\luasocket"

I think installing the DLL into the proper directory is the way to go.
No path redefinition required for every module you install.

BTW: I do not think that the old 'L*.DLL' convention is really useful or
necessary any longer. The Lua search path is not supposed to contain
system directories. And Lua modules should not be placed into system
directories, too.

There is no point in loading a system DLL with require(). If you need Lua
for this at all, then the path agnostic loadlib() plus an extra path scheme
should work best.