|
|
|
|
|
by pb82
2447 days ago
|
|
Thats clever. I used the same approach with lua_sethook to run a hook every X opcodes and check if time or memory constraints have been exceeded. But instead of yielding I used longjmp to terminate execution (basically like raising an exception and catching it a few levels up in the stack). It's not bulletproof though and the script can still block e.g. when calling into native code. |
|
The advantage to this method over longjmp is that the function call is still valid and can be resumed at any point.