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

Place to get help with not working mods / modding interface.
Post Reply
Flux Faraday
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Sat May 10, 2014 8:48 am
Contact:

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

Post 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.
Last edited by Flux Faraday on Sat Feb 14, 2015 8:17 am, edited 1 time in total.

hoho
Filter Inserter
Filter Inserter
Posts: 675
Joined: Sat Jan 18, 2014 11:23 am
Contact:

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

Post 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

User avatar
Xecutor
Filter Inserter
Filter Inserter
Posts: 260
Joined: Mon Jun 23, 2014 10:15 am
Contact:

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

Post 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.

Flux Faraday
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Sat May 10, 2014 8:48 am
Contact:

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

Post 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.

User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

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

Post 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 :)

Post Reply

Return to “Modding help”