lua-users home
lua-l archive

Creating a default error handler for lua_pcall

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


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.

AltStyle によって変換されたページ (->オリジナル) /