lua-users home
lua-l archive

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


>I need to somehow get the currently running chunk's name (at
>truntime).I know this can be done via debug.getinfo(1,"n").name but
>the manual(and that "debug" part of it) strongly suggest against using
>it for non-debug code.

The manual says this because the debug functions can be "slow". But if you
really need the chunk's name, it's perfectly all right to use debug.getinfo.
If you want to protect the rest of your application from using the other
functions in the debug library, perhaps you can just do getinfo=debug.getinfo
and then debug=nil. Or do
	
	function chunkname()
		return debug.getinfo(1,"n").name
	end
--lhf