lua-users home
lua-l archive

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



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