|
>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 >as well. ->-lhf
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...