[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_getinfo(L,"n",&ar) doesn't use upvals to guess function name?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Fri, 19 Mar 2004 14:57:38 -0300
> Is my understanding correct that lua_getinfo(L,"n",&ar) does not look
> at the previous stack frame's upvalues when guessing a "name" for the
> If so, is there any reason why not?
No, besides some extra complexity.
> My workaround for this will be to query the calling 'ar' myself and
> search the named upvals (if getinfo fails to find the name through the
> normal mechanism). Is there any reason why this is a bad idea?
Quite the opposite. We have plans for moving this whole "name guessing"
stuff outside the Lua core into a library (at least the part that can
be implemented with the debug API). In that way, the algorithm could be
smarter and easier to change (e.g., it could look inside libraries to
find names like "math.sin", could look for upvalues, etc.)