lua-users home
lua-l archive

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

On 7/05/2013, at 7:02 PM, Dirk Laurie <> wrote:

> How hard is it for a running function to find out the name of the
> function from which it was called?

> I've snooped around with debug.getlocal and debug.getinfo and
> I can't find it.

Does this help?

$ lua
Lua 5.1.5  Copyright (C) 1994-2012, PUC-Rio
> function a() print(debug.getinfo(2, "n").name) end
> function b() a() end
> b()
> c = b
> b = nil
> c()