I'd like to write a program where the user can type something at any of several entry prompts and have the program close neatly. What comes to my mind is using xpcall() to call a main loop function, having the code throw up a 'done now' error() whenever it gets the 'quit' input, and have xpcall()'s message handler check for that error and handle it with a 'okay, see you' message, with debug.traceback() being called if any other errors pop out. Is there a better way?
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'd like to write a program where the user can type something at any of several entry prompts and have the program close neatly. What comes to my mind is using xpcall() to call a main loop function, having the code throw up a 'done now' error() whenever it gets the 'quit' input, and have xpcall()'s message handler check for that error and handle it with a 'okay, see you' message, with debug.traceback() being called if any other errors pop out. Is there a better way?
Link to post
Share on other sites