Lua - find out calling function
function, lua
Solution
You could use `debug.traceback()`:
function a()
print(debug.traceback())
end
function b()
a()
end
b()
which would print:
stack traceback:
./test.lua:45: in function 'a'
./test.lua:50: in function 'b'
./test.lua:53: in main chunk
[C]: in ?
Problem
In Lua, is it possible to know which function has called the current function. For instance ``` function a() get_calling_function() --Should print function b end function b() a() end ``` Is something like this possible? Does the debug library have such functionality?