Page 1 of 2

In love terminal

Posted: Fri Aug 13, 2010 7:51 am
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.

Re: In love terminal

Posted: Fri Aug 13, 2010 8:24 am
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

Re: In love terminal

Posted: Fri Aug 13, 2010 9:24 am
by Lap
.................................................FFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU!!!!!!!!!!!!!!!!!!!

Re: In love terminal

Posted: Fri Aug 13, 2010 1:00 pm
by vrld
This is an awesome feature! You could do livecoding performances with that!

Re: In love terminal

Posted: Fri Aug 13, 2010 2:37 pm
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

Re: In love terminal

Posted: Fri Aug 13, 2010 2:56 pm
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? ;)

Re: In love terminal

Posted: Fri Aug 13, 2010 3:56 pm
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..

Re: In love terminal

Posted: Fri Aug 13, 2010 5:20 pm
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.

Re: In love terminal

Posted: Fri Aug 13, 2010 10:21 pm
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.

Re: In love terminal

Posted: Fri Aug 13, 2010 11:29 pm
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.