lua-users home
lua-l archive

Re: debug.getinfo(..).name is set/nil depending on subtle differences

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


Federico:
On Wed, Dec 16, 2020 at 12:00 PM Federico Ferri
<federico.ferri.it@gmail.com> wrote:
> I found an issue with my code and debug.getinfo() which I reduced to the following testcase:
....
> So, why in f2 the field 'name' is nil?
Mandatory tail call elimination? I get this, have not dug more as I'm
not too familiar with the expected returns:
Lua 5.3.3 Copyright (C) 1994-2016 Lua.org, PUC-Rio
> function g()
>> for k,v in pairs(debug.getinfo(1,'n')) do print(k..'='..v) end
>> end
>
> function f1()
>> local r=g()
>> return r
>> end
>
> function f2()
>> return g()
>> end
> f1()
name=g
namewhat=global
nil
> f2()
namewhat=
> g()
namewhat=
Francisco Olarte.

AltStyle によって変換されたページ (->オリジナル) /