[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: current directories
- From: Matthew Wild <mwild1@...>
- Date: Fri, 5 Mar 2010 13:09:09 +0000
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