Page 1 of 1

Modding Debug

Posted: Sat May 05, 2018 3:23 am
by Monsterbolt101
It would help if there was some way to either throw "errors" or to show a debug log on the loading screen for development of mods. I find it really tedious waiting for the game to load only to find that inside my data-update.lua file that only one prototype was loaded vs 20. I do know that if you load factorio through the cmd on windows it has this feature when using print, but I have recently switched to the steam version of the game and as soon as the game loads the steam-client-api the console just closes and runs the game without it. I just need some sort of feedback from the mod to know whats happening behind the scene. Thanks! :D

Re: Modding Debug

Posted: Sat May 05, 2018 4:08 am
by betrok
You can write to the log file with log(). And you actually can throw an error with literally error().

Re: Modding Debug

Posted: Sun May 06, 2018 1:43 am
by Monsterbolt101
Thank you, I actually didn't know that. Im assuming thats probably a lua function. Thank you again

Re: Modding Debug

Posted: Tue May 08, 2018 8:14 am
by bobingabout
I knew about log(), but didn't know about error()... though to be fair I can't see a reason to throw an error on purpose, usually when errors happen, I fix them.

Re: Modding Debug

Posted: Tue May 08, 2018 8:24 am
by rldml
bobingabout wrote:I knew about log(), but didn't know about error()... though to be fair I can't see a reason to throw an error on purpose, usually when errors happen, I fix them.
oh this is an easy one: There could be situations, where the game- or lua-engine don't recognize an error, but your code works different than you thought. In that situation, additional error messages in functions can help you determine the problem and make it easier for you to fix them.

But of course, you could easly work with log() instead ;)