[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: require cascade
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 10 Feb 2010 15:27:39 +0200
On Wed, Feb 10, 2010 at 3:11 PM, Wim Langers <firstname.lastname@example.org> 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>')