lua-users home
lua-l archive

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


On Wed, Feb 10, 2010 at 3:11 PM, Wim Langers <wim.langers@adrias.biz> wrote:
> That is :
> - if Lua can find your "main" module, but if it can't you don't have
> anything to run anyway :-)
> - and if the base directory is in the Lua path.

Well, why should it have to be in the Lua path? We have a program on
the system path, it knows where it has been loaded from (either
absolute or relative); then it's just a matter of fixing up
package.path using this path and require() will then pick the local
modules by preference.  Then the whole application is relocatable
without any need to mess with LUA_PATH.

OK, on Unix the preference would be to create a symbolic link from the
main script on the system path. Then there's a need to look up the
symlink first. But the principle is the same.

(On Windows, the installer would create a little batch file that
contains 'lua <full-path-to-script>')