Page 1 of 1

[answered] Where does lua's print function output go?

Posted: Sat Feb 14, 2015 7:24 am
by Flux Faraday
Does anyone know where lua's "print" function writes to? I don't see it on screen, nor do I see it in the log file. I'm working on a mod, so "game.player.print" doesn't work yet. Is there a way to direct it to a file? That would work for me.
Thanks!

[edit] see post 4 for a workaround/answer.

Re: Where does lua's print function output go?

Posted: Sat Feb 14, 2015 7:58 am
by hoho
I think there currently are no ways of getting any kind of text output from code that gets run from data.lua (or data-updates.lua or data-final-fixes.lua). In code ran from control.lua you can use makefile to make log file: https://forums.factorio.com/wiki/inde ... e#makefile

Re: Where does lua's print function output go?

Posted: Sat Feb 14, 2015 7:59 am
by Xecutor
On linux and mac os x it prints to terminal (stdout).
On windows, I'm afraid, it prints to non-existent console and you can't capture this output.

Re: Where does lua's print function output go?

Posted: Sat Feb 14, 2015 8:16 am
by Flux Faraday
Xecutor wrote:On linux and mac os x it prints to terminal (stdout).
On windows, I'm afraid, it prints to non-existent console and you can't capture this output.
Thanks for this!! All I have to do to fix this is make the console exist. So, in Windows, start a "cmd" window, navigate to Factorio's x64 directory, run Factorio as

Code: Select all

.\Factorio.exe > junk.log
then my lua print output shows up in junk.log.

Re: [answered] Where does lua's print function output go?

Posted: Sat Feb 14, 2015 5:20 pm
by FreeER
Flux Faraday's is the best solution, but if you just want something quick and dirty I often use error(serpent.block(something)) to make Factorio show me the value of something in an error dialog :)