[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Breaking infinite loops / stopping code execution from C
- From: datashadow@...
- From: Stratos <datashadow@...>
- Date: Tue, 20 Aug 2002 14:39:08 -0300
- Date: Tue, 20 Aug 2002 19:39:50 +0200
>I was just wondering if there is any way to immediately stop Lua execution,
>say, if some user scripts enter an infinite loop
>You can set a hook and then a timer and a timer handler that calls lua_error
>when the time has elapsed. In Lua 5.0 you'll be able to set "count" hooks
This can't be sufficient, as lua_error() will call exit() and the
application will immediately terminate.
Setting a hook may be a solution to break infinite loops, but is neither a
good solution, as neither a counting hook nor a timer-based approach are
very flexible. But the main problem is, the script
MUST provide a way to stop execution on demand from the user, i.e. if
he/she clicks a button, which
won't be solved by setting a timer. Terminating the whole application
doesn't seem to be good practice, either. So still, the problem persists...