Print calls in scripts

I noticed that there are calls in GD’s lua files to print(), but when I try to use it, I’m not able to discern just where stdout is being sent. Is this developer-only functionality?

Maybe you can read it with Console from Custom Game. There’s a lot of stuff printed there.

Nope, doesn’t appear there. Trying to use Debug.Log (mentioned in the modding guide) doesn’t output to the console, nor to the log files in GD’s directory.

It should appear in log.html

Which, print() or Debug.Log()?

@Zantai I’ve tried Debug.Log, print, turning on game.LargeFileDump setting, deleting the log.html and log.xml files from the GD root directory, and nothing is getting written out. The Debug.Log and print test lines in my Lua file are right after a UI.Notify call that is being seen in-game, so I know the code is being executed.

I also tried both 32bit and 64bit executables, just to see. Made no difference.

Any other tips or hints?

Stick to UI.Notify ? :wink:

That’s not helpful for debugging or trying to learn what works and what doesn’t.

It is not ideal for debugging, but it absolutely is helpful.

You can also try the tool Grim Internals to develop your mod; it shows the output from the Lua print command in the console as you can see here:

3 Likes

Looks like that’s going to be the thing to do, thanks for letting me know!

Edit: figured I’d add this - Grim Internals shows that my Lua script errors with an exception - unknown global “Debug”, just in case anybody reads that, you know, has the opportunity to possibly fix that.

@GlockenGerda What’s the syntax for debug logging to GI’s console?

Afaik there is no debug logging syntax you can use;
the Lua Debug-, I/O and OS Libraries aren’t loaded by the game anyways.
I use only the “print” command in my Lua scripts for debugging; no other commands.

Perhaps someone knows it better.

Yep, that’s what I discovered after asking that. Print seems to work.