lua-users home
lua-l archive

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


On Fri, Mar 5, 2010 at 4:44 AM, spir <denis.spir@gmail.com> wrote:
> Hello,
>
> Is there:
> * a r/w variable holding the current "require directory", meaning the first '.' in "./?.lua",
> * a way to know the current module's directory?
>
> denis
> --
> ________________________________
>
> la vita e estrany
>
> spir.wikidot.com
>
>

Yes, it was mentioned a little while ago:

On Mon, Feb 22, 2010 at 9:57 AM, Peter Cawley <lua@corsix.org> wrote:
> In most cases, placing the following in a .lua file outside of any
> function should get the directory which the file is placed in:
> local path = debug.getinfo(1, "S").source:match[[^@?(.*[\/])[^\/]-$]]
>