Page 1 of 1

fflush from traceback

Posted: Mon Jan 06, 2014 1:40 am
by Castler
Debugging Lua errors that occur during loading a module or generating a level can be tricky. The game's standard error dialog is never invoked, and the loading / generating never finishes, so I have to kill the process and check the logfile, which may or may not have gotten the error message flushed to it.

If I understand the code correctly, having main.c's traceback call fflush(stdout); would ensure that Lua errors are always flushed to the log, regardless of what may go wrong at higher-level code or whether or not higher-level code is in a place to check for and display error dialogs.

Re: fflush from traceback

Posted: Mon Jan 06, 2014 10:27 am
by jenx
Castler wrote:Debugging Lua errors that occur during loading a module or generating a level can be tricky. The game's standard error dialog is never invoked, and the loading / generating never finishes, so I have to kill the process and check the logfile, which may or may not have gotten the error message flushed to it.

If I understand the code correctly, having main.c's traceback call fflush(stdout); would ensure that Lua errors are always flushed to the log, regardless of what may go wrong at higher-level code or whether or not higher-level code is in a place to check for and display error dialogs.
you can force constant flushing by running as te4.exe --flush-stdout in window. juse baretail.exe or similar to follow it.

it will slow the game only slightly.

Re: fflush from traceback

Posted: Mon Jan 06, 2014 12:23 pm
by darkgod
yup good idea