lua-users home
lua-l archive

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


On 5 March 2010 12:44, spir <denis.spir@gmail.com> wrote:
> Hello,
>
> Is there:
> * a r/w variable holding the current "require directory", meaning the first '.' in "./?.lua",

No, because Lua doesn't have this information. How you get this
information is platform-dependent. For example you could use a POSIX
library and call getcwd().

> * a way to know the current module's directory?

The same applies, if it was loaded with a relative path - and I seem
to recall that Lua 5.2 will allow you find which file a given
require() call will match, both combined should give you the answer.

Matthew