Something like this:
function foo()
print( __func__ )
...
end
How can it be done?
function __FILE__() return debug.getinfo(2, 'S').source end
function __LINE__() return debug.getinfo(2, 'l').currentline end
function __FUNC__() return debug.getinfo(2, 'n').name end
function printlinefilefunc()
print("Line at "..__LINE__()..", FILE at "..__FILE__()..", in func: "..__FUNC__())
end
Output:
Line at 8, FILE at @./andydebug.lua, in func: printlinefilefunc