Something like this:
function foo()
print( __func__ )
...
end
How can it be done?
You can try:
local dbFunc = debug.getinfo(1) and debug.getinfo(1).name or ""
Info
Info["currentline"] = 1376
Info["source"] = "@.\mymod.lua"
Info["short_src"] = ".\mymod.lua"
Info["nups"] = 13
Info["isvararg"] = false
Info["what"] = "Lua"
Info["lastlinedefined"] = 1570
Info["func"] = function: 000000000030B440
Info["istailcall"] = false
Info["linedefined"] = 1375
Info["namewhat"] = "field"
Info["name"] = "ExportDB" <<--- See here the function name
Info["nparams"] = 4
debug.getinfo(1)
Returns this structure of the current execution state of the active function in the stack.
If n is larger than the number of active functions in the stack, debug.getinfo()
returns nil.
That's why you have to check if it exists before taking *.name and return an empty string if the information is not available
A it is called inside the ExportDB()
function, it return its name