In love terminal

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.
User avatar
Lap
Party member
Posts: 256
Joined: Fri Apr 30, 2010 3:46 pm

In love terminal

Post by Lap »

Has anyone ever made anything that can essentially function as an in game terminal?

Basically, I hit F1 or whatever key I assign this library to and it pops up with a window where I can directly type in codes of lua. Something like his would make debugging stuff far easier.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: In love terminal

Post by nevon »

Add this to your main.lua file, and there you have it!

Code: Select all

function love.keypressed(key, u)
	--Debug
	if key == "rctrl" then --set to whatever key you want to use
		debug.debug()
	end
end
That will stop the game and you can then write stuff into the terminal that you started the game from. To continue with the game, just run:

Code: Select all

cont
User avatar
Lap
Party member
Posts: 256
Joined: Fri Apr 30, 2010 3:46 pm

Re: In love terminal

Post by Lap »

.................................................FFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU!!!!!!!!!!!!!!!!!!!
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: In love terminal

Post by vrld »

This is an awesome feature! You could do livecoding performances with that!
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartoleo
Party member
Posts: 118
Joined: Wed Jul 14, 2010 10:57 am
Location: Savigliano

Re: In love terminal

Post by bartoleo »

I Tried, but in windows it needs the "console"
the only ways to activate it are:
1) --console
2) in conf.lua t.console = true

would be nice to open it at runtime
Bartoleo
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: In love terminal

Post by nevon »

bartoleo wrote:I Tried, but in windows it needs the "console"
the only ways to activate it are:
1) --console
2) in conf.lua t.console = true
Yeah, but come on, who develops in Windows? ;)
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: In love terminal

Post by bartbes »

Well, yes it needs that, but I for one always use the terminal to dump my debug messages, so I'll always need a terminal for debugging anyway.
Also, I'd like to note that this is a lua feature and not a LÖVE feature, which is a :awesome: for my responsibility, but a :x because.. well, I didn't make such a cool feature..
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: In love terminal

Post by Jasoco »

Holy crap! That works!

I had originally created one that would, when I press Tilde (~) give me a screen where I can type commands like in Quake engines, and when I press Enter it would save the code to a Lua file and run it. But it wouldn't work right so I gave up. THIS is so much better and exactly what I need. Awesome!

Edit: @Bartbes: Me too. I have the console (Terminal) open all the time and run the game from it every time so I can read the debug printouts I put in there for testing. So glad you told us about this.
User avatar
Lap
Party member
Posts: 256
Joined: Fri Apr 30, 2010 3:46 pm

Re: In love terminal

Post by Lap »

bartbes wrote:Also, I'd like to note that this is a lua feature and not a LÖVE feature'
Yea I figured this was a lua one since it wasn't anywhere in the wiki. Every time I've used lua the framework or engine had it's own console do this anyways so I've never known about it. Oh the troubles I could have saved already. At least I didn't try to make my own gui version.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: In love terminal

Post by Jasoco »

Lap wrote:
bartbes wrote:Also, I'd like to note that this is a lua feature and not a LÖVE feature'
Yea I figured this was a lua one since it wasn't anywhere in the wiki. Every time I've used lua the framework or engine had it's own console do this anyways so I've never known about it. Oh the troubles I could have saved already. At least I didn't try to make my own gui version.
Hey! It wasn't that hard to implement. I'm just glad this way is better.
Post Reply

Who is online

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