For Lua functions, you can set a count hook and call error for there. For C functions, you need a real timer. Even then, you need to be careful how you interrupt Lua. See how lua.c does it or my lalarm. --lhf