lua-users home
lua-l archive

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

Good timing, I was looking for a way to do this, too! I wish I didn't
have to resort to using the debug library, though...


On Mon, Feb 22, 2010 at 10:58 AM, Jorge <> wrote:
> On Mon, 2010-02-22 at 17:57 +0000, Peter Cawley 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[[^@?(.*[\/])[^\/]-$]]
> Thanks Peter and PA, that was fast.
> So i got to the point where i need to use the debug library! Whooho! I'm
> a pro! :)
> Jorge