lua-users home
lua-l archive

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


On Tue, Jan 21, 2020 at 8:20 AM Hongyi Zhao <hongyi.zhao@gmail.com> wrote:

> Is there any robust and convenient methods for me to obtain the lua script's (absolute/real) dirname and file name from within the script itself?

Your question is not well defined. Lua can load and execute a string that resides entirely in memory without ever been stored in a file - is that a script? A Lua chunk can load and run another chunk, etc, some of which may or may not file based - what is "the script" in this case? Unless you indicate exactly what your "script" is, you are not going to get an unambiguous answer.

Cheers,
V.