[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_pcall vs lua_call
- From: Matthew Paul Del Buono <delbu9c1@...>
- Date: Fri, 18 Jul 2008 21:18:06 -0400 (EDT)
>2008/7/18 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> A panic function is not a way to handle errors in your app; it's just
>> what it says, a panic exit... So, use lua_pcall or lua_cpcall.
>
>What is a valid action in a panic function? In a long-running
>application, I may *really* want to avoid terminating. I can live with
>throwing away all the Lua state, but I want to have my app continue.
>Is it safe to call lua_close on a state that has panicked? If not, is
>there any other way to recover the memory locked up in the state,
>before I discard it?
>
>Thanks,
>Paul.
As I pointed out earlier in this thread, the state is invalid after it has panicked :)
The only valid operation is lua_close. Yes that is safe to call. You can avoid a program exit by never returning, e.g., by using a longjmp().
-- Matthew P. Del Buono