Something like this:
function foo() print( __func__ ) ... end
How can it be done?
Use the Debug Library. It provides a getinfo(func) function that returns a table with information about the function.
getinfo(func)