lua-users home
lua-l archive

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

2011/1/21 Gustavo de Sá Carvalho Honorato <>:
> Hi,
> how can I use require function passing the file path relative to the file
> that is calling the require function, as we do with #include in C?

Refer to the recent thread "How to get the directory of the current
executed file?"

As mentioned in that thread, debug.getinfo(1, "S").source:sub(2) will
give you the name of file being executed - you just need to split out
the dirname and then edit your package.path appropriately.