[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: require cascade
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 8 Feb 2010 15:44:31 +0200
On Sun, Feb 7, 2010 at 11:11 AM, spir <denis.spir@free.fr> wrote:
> I guess the current dir (I mean ./) is not updated to /data when passing from the module "stack" to the module "STACK_CATS": when copying the file stack.lua into the top dir, all works fine. Am I doing something wrong? Is there a way to force module search in the actual current dir?
The problem often appears when wanting a program to be self-contained.
Then the best way is for the main module to update package.path
directly before requiring anything, but this requires that the module
knows exactly where it is loaded from; you can usually get this from
arg[0]. That is, say arg[0] is '/bonzo/dog/main.lua' then you can
prepend '/bonzo/dog/?.lua;' to the package.path.
steve d.