I've tried everything I can find to figure out how to stop this from happening, but since I can't seem to find anything at all, I'll put it here.
I have a program that relies on a timer to execute some control logic periodically. The code currently has a fatal error in it and crashes, but I haven't been able fix it because I'm not able to use the computer afterward without rebooting it, because the timer event that the program starts apparently never stops, so no matter what I'm doing with the computer, every fifteen seconds it spits out a timestamp followed by "Checking inventory.... Press TAB to exit.". Even though the program that started the timer has crashed.
Now, I understand that the timer ends up as a global object or whatever it is that doesn't go away until explicitly destroyed by a call to event.cancel(). What I can't figure out is how to catch a crash--any crash--and destroy this timer so that it doesn't keep running this subroutine while I'm trying to debug.
My first thought was to wrap the whole program in a try ... catch, but apparently those don't exist in Lua and I can't even begin to understand what's going on with pcall and xpcall; trying to wrap the main function in them doesn't seem to do anything.
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
I've tried everything I can find to figure out how to stop this from happening, but since I can't seem to find anything at all, I'll put it here.
I have a program that relies on a timer to execute some control logic periodically. The code currently has a fatal error in it and crashes, but I haven't been able fix it because I'm not able to use the computer afterward without rebooting it, because the timer event that the program starts apparently never stops, so no matter what I'm doing with the computer, every fifteen seconds it spits out a timestamp followed by "Checking inventory.... Press TAB to exit.". Even though the program that started the timer has crashed.
Now, I understand that the timer ends up as a global object or whatever it is that doesn't go away until explicitly destroyed by a call to event.cancel(). What I can't figure out is how to catch a crash--any crash--and destroy this timer so that it doesn't keep running this subroutine while I'm trying to debug.
My first thought was to wrap the whole program in a try ... catch, but apparently those don't exist in Lua and I can't even begin to understand what's going on with pcall and xpcall; trying to wrap the main function in them doesn't seem to do anything.
Any help would be greatly appreciated.
Link to post
Share on other sites