Setting timeout for embedded Lua

Posted by skyeagle on Stack Overflow See other posts from Stack Overflow or by skyeagle
Published on 2010-12-22T10:19:32Z Indexed on 2010/12/22 10:54 UTC
Read the original article Hit count: 187

Filed under:
|
|

I have embedded Lua in a C/C+= application. I want to be able to set a timeout value to prevent getting trapped with badly written scripts that can result in infinite loops (or even string searches that take an infinite time to complete).

Basically, I want to be able to set a time interval and if the script fails to complete running at the end of that time interval, I want to be able to kill the Lua script engine (gracefully, if possible).

Anyone knows of best practise way to do this?

© Stack Overflow or respective owner

Related posts about c++

Related posts about c