lua-users home
lua-l archive

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



Thanks for your note.

You're welcome.

I read the debug stuff before posting but assumed it wasn't meant for runtime use.

Well, I guess it depends on what makes something suitable for runtime use. But I have been using the debug interface for an integrated light-weight profiler and can testify it works quite well. Obviously, there is some overhead. You should probably run some tests to see if it suits your situation.

From your example I understand you need to resolve the names of functions passed as arguments [and not functions in the *call stack*]. I may be stating the obvious, but I believe lua_getinfo should work here as well (though I've never used it for this particular purpose). You'll need push the function (using lua_pushvalue, for instance) and prepend a ">" to the 'what' argument before calling lua_getinfo.

Keep in mind an arbitrary Lua function may not have a name. An example would be a closure created a runtime. If you have a specific (managed) set of functions that you need to recognise, you might try to build an index table to perform quick function-to-name lookup. I suspect that'll be quicker than using lua_getinfo.

I'm curious: what type of situation would require you to actually retrieve the names of functions so often?

Ashwin.
--
no signature is a signature