How to View print()-ed stuff.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
SeaOfTime
Prole
Posts: 2
Joined: Sat Sep 03, 2011 2:31 am

How to View print()-ed stuff.

Post 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.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

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

Post 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.
SeaOfTime
Prole
Posts: 2
Joined: Sat Sep 03, 2011 2:31 am

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

Post by SeaOfTime »

Thank you very much! Works perfectly.
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

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

Post 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?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

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

Post 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.
Help us help you: attach a .love.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post 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.
User avatar
Bryant
Prole
Posts: 8
Joined: Wed Sep 28, 2011 12:12 am
Location: Vancouver, BC, Canada
Contact:

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

Post 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...).
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

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

Post 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).
Help us help you: attach a .love.
User avatar
Bryant
Prole
Posts: 8
Joined: Wed Sep 28, 2011 12:12 am
Location: Vancouver, BC, Canada
Contact:

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

Post 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...
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

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

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

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 188 guests