lua-users home
lua-l archive

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


Rici Lake wrote:
Lee Hickey wrote:

Thanks. What I forgot to mention is that I want to remove the overhead of having to insert this extra parameter for every pcall. My game engine makes many pcalls and I would rather have each of these calls be as cheap as possible. This need isn't based on any kind of profiling, so I am guilty of a little blind optimising, but many unnecessary lua_inserts per frame seems like a sensible thing to avoid if at all possible.

Regards,
Lee.

It's probably not that expensive. But you might want to try to cut down on the number of pcalls, for example by using an "outer pcall" which calls function which performs a sequence of lua functions. (Of course, you could also seek & destroy C functions which don't conform to your stack guidelines.)
Thanks for the suggestions. Both of those things will work of course, and I'll do both, however, I can't help feeling there should be a way to set up a default error handler. A pseudo-index type approach seems like a sensible way, so I think I'll have a play at adding that in. Has there been any work done on customisable pseudo-indices?

Regards,
Lee