lua-users home
lua-l archive

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


KHMan wrote:
Robert Raschke wrote:

On Mon, Apr 26, 2010 at 4:25 PM, Lorenzo Donati wrote:

    Now to the point.
    I need a way to make a Lua script know it's exact location, i.e. its
[snip]
I don't think this is possible without using C. I use GetModuleFileName() in my Windows C startup code to find where the EXE is that got invoked.

But there's also the location of a particular Lua script you're getting via require. I don't know if that allows you to figure out where it came from.

Depending on how "proper" Lorenzo wants it to work, for "100% works" Unicode paths may also have to be supported... Hard to accomplish using pure Lua.

Wow! Really a prompt response!
Many thanks to all involved, I greatly appreciate that.
Lots of stuff on which to ponder! :-)
I didn't even think of the Unicode issue - usually I stick to ANSI names (old DOS habits) but good to know when it comes to look for unknown files! I will let you know as soon as I have time to try out all those hints and ideas.
Thanks a lot again.
Lorenzo