[Date Prev][Date Next][Thread Prev][Thread Next]
- 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 <firstname.lastname@example.org> 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. That is, say arg is '/bonzo/dog/main.lua' then you can
prepend '/bonzo/dog/?.lua;' to the package.path.