Lua output gripe (windows)

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:

Lua output gripe (windows)

Post by Flux Faraday »

Before v12, Factorio's lua output didn't appear (in windows) unless you redirected Factorio's stdout from the command line (see this post https://forums.factorio.com/forum/vie ... =25&t=8661 ). Now, Lua's output appears unconditionally, but isn't going through stdout (or stderr), so I'm unable to redirect it to a file. That makes it harder to debug, because the interesting part of the lua output has usually scrolled off the top of Windows' CMD window. It would be nice if this could, once again, be output in a way that it can be redirected and analyzed. Or, if it can be redirected, please let me know how. [edit:] Maybe all of this is going to go into a log file someday. That would work too.

Thanks!!
Last edited by Flux Faraday on Wed Aug 05, 2015 9:45 pm, edited 1 time in total.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lua output gripe (windows)

Post by Adil »

What? The only output I'm getting on linux is the ingame console and a couple log files in root directory of the game.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

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

Re: Lua output gripe (windows)

Post by Flux Faraday »

In addition to lua output, it is printing some timestamped status. Like this:

Code: Select all

C:\Users\whn\Desktop\Gamestuff\Factorio_0.12.1\bin\x64>Factorio.exe

C:\Users\whn\Desktop\Gamestuff\Factorio_0.12.1\bin\x64>   0.000  Info Main.cpp:1
50: Program arguments: "0,000,005,E6D,DFC,8B0"
   0.001 2015-08-05 14:22:56; Factorio 0.12.1 (Build 16116, win64)
   0.001 Operating system: Windows 8.1
   0.001 Read data path: C:/Users/whn/Desktop/Gamestuff/Factorio_0.12.1/data
   0.001 Write data path: C:/Users/whn/Desktop/Gamestuff/Factorio_0.12.1
   0.001 Binaries path: C:/Users/whn/Desktop/Gamestuff/Factorio_0.12.1/bin
   0.003 Info LocaleProvider.cpp:282: Language en is LTR
   0.003 Info LocaleProvider.cpp:282: Language en is LTR
   0.065 Initialised Direct3D: NVIDIA GeForce GTX 970; driver: nvd3dumx.dll 10.1
8.13.5362
   0.125 Graphics options: [FullScreen: true] [VSync: true] [UIScale: 100%] [Mul
tiSampling: OFF] [Graphics quality: normal] [Video memory usage: all]
   0.231 Loading mod core 0.0.0 (data.lua)
   0.236 Loading mod base 0.12.1 (data.lua)
   0.679 Info LocaleProvider.cpp:282: Language en is LTR
   0.679 Info LocaleProvider.cpp:282: Language en is LTR
   0.682 Info LocaleProvider.cpp:282: Language en is LTR
   0.682 Info LocaleProvider.cpp:282: Language en is LTR
   0.766 Initial atlas bitmap size is 16384
   0.768 Created atlas bitmap 16384x7656
   8.943 Factorio initialised
  14.741 Goodbye
Notice the second command prompt? It looks like Factorio is putting itself in background somehow (and probably dropping the file descriptors it starts with). Version 11 stayed in the foreground.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lua output gripe (windows)

Post by Adil »

Well, to me it looks exactly like factorio-current.log from the factorio folder. If it doesn't appear on windows, I'd report a bug.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

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

Re: Lua output gripe (windows)

Post by Flux Faraday »

factorio-current.log does appear in Windows, but has no lua output in it. That would be a great place for the output to go!

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lua output gripe (windows)

Post by Adil »

Which lua output you're talking again?
I've never seen game.player.print() put anything anywhere apart from ingame console. And log files only ever received error messages from prior initialization or crashes.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

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

Re: Lua output gripe (windows)

Post by Flux Faraday »

I'm talking about the output from the lua built-in function called "print". Most of my modding changes happen at "data.lua" time, so the "game.player.print" function doesn't exist yet. Even if it did, it prints to the screen in-game, so it would not be useful for tracking down an algorithmic error, or printing the contents of a bunch of tables for study.

Like this:

----data.lua----
print(data.raw.recipe["speed-module"].energy_required)
------------------

...would print the time to produce a speed module.

User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Lua output gripe (windows)

Post by Adil »

Ah, that's why it doesn't error on /c print(' ') :?
It works on linux. Both print() from data and console cause text to appear in terminal. And if I launch factorio with redirecting to file (./factorio >> file.txt) I do get the file with all the output.
You really should contact devs about it.
Another silly advice would be try powershell instead of cmd. (It's more of normal terminal, yes?)
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.

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

Re: Lua output gripe (windows)

Post by Flux Faraday »

Adil wrote: Another silly advice would be try powershell instead of cmd. (It's more of normal terminal, yes?)
That's a great suggestion. I'll try it in the morning, and file a bug report if I still can't capture my output.
(Maybe instead of PowerShell I should just play it on Linux :) I miss bash. )

Thanks!

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

Re: Lua output gripe (windows)

Post by Flux Faraday »

Powershell helps (a lot) because it has a much larger scroll area than cmd does. But since I still cannot capture the output, I'll file a bug report. Thanks!

Post Reply

Return to “Modding help”