lua-users home
lua-l archive

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


On Tue, Feb 24, 2009 at 7:04 AM, Alexander Gladysh <agladysh@gmail.com> wrote:

> Say, I set instruction count hook. If it is triggered (and some
> condition is met -- given time passed, for example), I need to kill
> Lua state. How do I kill it most gracefully? I'd like all allocated
> resources to be freed. (I think it would be perfect to be able to
> imitate conventional runtime error raised from the hook point. Not
> sure if this is achievable though...)

I have an application that does this,
from inside the debug hook callback:

if (timeout) {
  lua_pushstring(L, "Script timeout.");
  lua_error(L);
}

and it *seems* to work fine, but I'm no expert...

 - Jeff