[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What is the name of the calling function?
- From: Geoff Leyland <geoff_leyland@...>
- Date: Tue, 7 May 2013 19:26:56 +1200
On 7/05/2013, at 7:02 PM, Dirk Laurie <email@example.com> 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 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> function a() print(debug.getinfo(2, "n").name) end
> function b() a() end
> c = b
> b = nil