lua-users home
lua-l archive

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

On Mon, Jan 10, 2011 at 8:47 PM, Thomas Harning Jr. <> wrote:
> Now, you do need to make sure that you protect your call-sites Lua->C
> so that C++ exceptions don't bubble past Lua as well as Lua errors
> don't bubble past C++ stack mgmt (always pcall).

That's exactly what I am doing.  But, in order to prepare the pcall,
you need to push several values onto the stack.  Pretty much all the
lua_push* routines can still fail due to out-of-memory conditions.
I.e. my code may end up exiting unexpectedly through the Lua panic
routine regardless of all the efforts gone into the pcall.  (That
said, out-of-memory situations are rare and recovering from them is
hard, if not impossible.  So I have taken this as a reasonable risk
and assume that this case will never happen.)

Julio Merino