[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Creating a default error handler for lua_pcall
- From: Lee Hickey <lahickey@...>
- Date: Fri, 09 Mar 2007 15:15:35 +0000
Hi all,
Currently, I add an error handler to the stack each time I call
lua_pcall, by the usual method of 'insert'ing it at the appropriate
point. As this gets done very frequently, I want to remove the overhead.
An obvious way is to put the error handler on the stack once and use its
absolute stack position in each subsequent call to lua_pcall.
The problem with this is that it is susceptible to any other code that
inadvertently (or deliberately) changes the stack (lua_settop(L, 0), for
instance).
Is there a way around this without creating a butchered version of
lua_pcall? I know at the moment lua_pcall will not accept
pseudo-indices, but it seems to me that this would be the perfect way of
solving this issue.
Best Regards,
Lee.