Page 1 of 2

How to View print()-ed stuff.

Posted: Sat Sep 03, 2011 7:08 pm
by SeaOfTime
I have searched the wiki and the forums for how to view the output of the print() function and i cannot figure out how to. I would like to use this for debugging, and would appreciate any help. I am not new to LUA, but have only been using LOVE for 3 days now.

Re: How to View print()-ed stuff.

Posted: Sat Sep 03, 2011 7:18 pm
by thelinx
Create a conf.lua file next to your main.lua file that contains this:

Code: Select all

function love.conf(t)
  t.console = true
end
For more info, see Config_Files.

Re: How to View print()-ed stuff.

Posted: Sat Sep 03, 2011 7:28 pm
by SeaOfTime
Thank you very much! Works perfectly.

Re: How to View print()-ed stuff.

Posted: Sun Sep 04, 2011 9:09 am
by T-Bone
In my experience, that is not necessary. I code my LÖVE games in gedit, and when I run the games within gedit through the addon "external commands" (or something like that), the output from print() appears in a box below the code, without having to set t.console = true.

Actually, I noticed now that when I run LÖVE games in the terminal directly, I also get the output without having to do t.console = true. I guess it's a difference between Linux and whatever OS (Windows?) SeaOfTime is using?

Re: How to View print()-ed stuff.

Posted: Sun Sep 04, 2011 9:37 am
by Robin
t.console = true is only for Windows, since on Unix there is no distinction between a terminal program and a non-terminal program. On Windows there is a distinction.

When testing, I always run games in the terminal, since I can see the print output then.

Re: How to View print()-ed stuff.

Posted: Sun Sep 04, 2011 8:06 pm
by Jasoco
On OS X I run my program through the terminal too. But in my current project. I decided to roll my own Debugger to print the messages on the game screen instead so I can leave the Terminal out of it.

Re: How to View print()-ed stuff.

Posted: Fri Sep 30, 2011 7:54 am
by Bryant
I'm on OS X and I'm not seeing any output when I call print() :( Is there a particular way that you run your programs through the terminal? I've been using open -n -a love "MyApp" (not sure what the -n and -a are doing...).

Re: How to View print()-ed stuff.

Posted: Fri Sep 30, 2011 8:44 am
by Robin
Bryant wrote:I'm on OS X and I'm not seeing any output when I call print() :( Is there a particular way that you run your programs through the terminal? I've been using open -n -a love "MyApp" (not sure what the -n and -a are doing...).
Have you tried love MyApp? (or love . if you're in the same directory as your game).

Re: How to View print()-ed stuff.

Posted: Fri Sep 30, 2011 8:50 am
by Bryant
Robin wrote:
Bryant wrote:I'm on OS X and I'm not seeing any output when I call print() :( Is there a particular way that you run your programs through the terminal? I've been using open -n -a love "MyApp" (not sure what the -n and -a are doing...).
Have you tried love MyApp? (or love . if you're in the same directory as your game).
Hmm, I just tried that, but I got this error message: "-bash: love: command not found." I also tried adding the folder containing the Love application file to my path environmental variable (I added a file with the directory to paths.d), but I still get the same error message...

Re: How to View print()-ed stuff.

Posted: Fri Sep 30, 2011 1:29 pm
by bmelts
open's not going to help you here. What you want is to call the love executable directly. There's two ways of doing this:

1) Refer to it every time. You'll need to know where you installed LÖVE for this - for instance, if you put love.app in /Applications, the command would be "/Applications/love.app/Contents/MacOS/love MyApp"

2) Make an alias. Create a pointer to that longer path that the Terminal can find, in /usr/local/bin or the like. "ln -s /Applications/love.app/Contents/MacOS/love /usr/local/bin/love" - then you can just type "love MyApp" every time you want to run something from Terminal.