[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What is the name of the calling function?
- From: Coda Highland <chighland@...>
- Date: Tue, 7 May 2013 00:30:38 -0700
On Tue, May 7, 2013 at 12:26 AM, Geoff Leyland
> On 7/05/2013, at 7:02 PM, Dirk Laurie <firstname.lastname@example.org> 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 Lua.org, PUC-Rio
>> function a() print(debug.getinfo(2, "n").name) end
>> function b() a() end
>> c = b
>> b = nil
Seems I spoke too soon!