lua-users home
lua-l archive

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


Cool.
Thanks for the info; my workaround seems to be doing just fine at finding the additional function names.

I appreciate Rici's comments about things with names being explicitly named, but this really is not part of my data model; its just an attempt to get a better stack trace when things go wrong, so I don't think its worth requiring code style changes at all function definition points.

--
Tim Gogolin

On Mar 19, 2004, at 11:57 AM, Roberto Ierusalimschy wrote:

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
function?

Yes.


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.)

-- Roberto