lua-users home
lua-l archive

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


you should include the full path to "Cat" as you did with "data.STACK_CATS" to the directory from where you started the program.
Alternatively you can change your working directory (eg. with lfs) to the "Cat" directory (which I don't think is such a very good idea), the reverse may also be true, that you accidentally changed the working directory and thus Lua can't find your module anymore.

Wim

On Sun, Feb 7, 2010 at 10:11 AM, spir <denis.spir@free.fr> wrote:
Hello,

I'm facing an issue I have no idea how to solve. In a subdir "data", a module "STACK_CATS" requires "Cat". STACK_CATS is itself required from a module "stack" in the top dir, using
  require "data.STACK_CATS"

Each require individually works, but the cascade does not:
lua: ./data/STACK_CATS.lua:3: module 'Cat' not found:
       no field package.preload['Cat']
       no file './Cat.lua'
       ...
stack traceback:
       [C]: in function 'require'
       ./data/STACK_CATS.lua:3: in main chunk
       [C]: in function 'require'
       stack.lua:31: in main chunk
       [C]: ?

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?

Denis
________________________________

la vita e estrany

http://spir.wikidot.com/