lua-users home
lua-l archive

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


This is a problem for OSs that do not have a concept of a current 
working directory. It would be nice (but not easy) for dofile to
first look in the directory name of the currently executing script.
(If the script came from a file)
DB 
+++++++++++++++++++++++++++++++++
>Is there any way from within a .lua file to know its current path (or 
>full filename)?
>
>This would be very handy in situations where a 'library' of lua code is 
>stored into several source files. Now i'm forced to keep all in one, 
>since otherwise the caller would need to provide not only the pathname, 
>but also the path separately:
>
>	SC_PATH= "..path.."
>	dofile( SC_PATH.."sc_main.lua" )
>
>If dofile arguments (passing arg[1] etc. as for functions) is ever 
>going to be included in Lua, it might be a good idea to have 
>arg.filename (or arg[0]?) for the full pathname?
>
>-ak