lua-users home
lua-l archive

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


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.