Debug - A whole new way of debugging your game

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

Re: Debug - A whole new way of debugging your game

Post by jack0088 »

why doesn't it work?
put the debug.lua into a directory and created inside the same a main.lua.
the main.lua has "require 'debug'" and "function love.load() print('hello') end" inside.
cannot activate cant see anything. whats wrong?
User avatar
Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

Re: Debug - A whole new way of debugging your game

Post by Qcode »

I've updated this myself for 0.8.0, most of the problems were in love.run.
Installation is mostly the same, except you can't name it debug.lua anymore. The code require "debug" doesn't seem to work anymore, it may be because it tries requiring the debug library. I've changed it to lovedebug.lua.
I've also added a new variable that you can set to customize this. Originally, you had to hold shift/control and press f8. It still defaults to f8, but now you can set _lovedebugpresskey to your "press key". Just something to make it more convenient.
Anyway, enjoy this new working version.
Attachments
lovedebug.lua
New for 0.8.0
(12.23 KiB) Downloaded 260 times
User avatar
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

Re: Debug - A whole new way of debugging your game

Post by jack0088 »

downloaded and tried, although I can't use it right now..
there are some errors appear, but looking into it.

would you mind uploading your .love project file, which is working for you?
User avatar
Qcode
Party member
Posts: 170
Joined: Tue Jan 10, 2012 1:35 am

Re: Debug - A whole new way of debugging your game

Post by Qcode »

I think I've fixed the errors you are talking about. For some reason left and right keys were returning unicode values of around 6000. They couldn't be translated by string.char, so I added a unicode limit of 500.
I also added some extra functionality to it, pressing tab will auto complete that variable to the current proposal. Also, pressing up restores your last command.
I've added the new file, and my game lovedebug is running in.
Attachments
lovedebug.lua
Fixed some errors
(12.78 KiB) Downloaded 246 times
User avatar
jack0088
Prole
Posts: 33
Joined: Fri Mar 22, 2013 4:59 am

Re: Debug - A whole new way of debugging your game

Post by jack0088 »

this is AWESOME. very useful!
PS: would be cool to have a repetitive keyboard behavior on pressed down keys. for example:
while love.keyboard.isDown("backspace") do
--delete command line
end
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Debug - A whole new way of debugging your game

Post by Ranguna259 »

I picked up Qcode's code and added some of my own (I've been adding stuff to this since I downloaded it)

There was one thing that I hated about this, it was when I had a lot of output in the console and I had to scroll all the way down to see the end, I've even spent MINUTES just scrolling and scrolling down and that sucked so I've added a new functionality:
  • You can now jump to the last output just by pressing the middle mouse button.



Let's make some changlogs for this:
Changelog
Version 1.2.2 (not official)
  • Added a new functionality that enables you to jump right to the bottom of the console by pressing the middle mouse button.
Version 1.2.1 (not official)
  • Fixed some bugs
  • Added a new functionality that autocompletes the variable to the current proposal by pressing tab
Version 1.2 (not official)
  • Converted to LÖVE 0.8.0
  • Added a new functionality that enables you to change the 'f8' key to what you want by changing the _lovedebugpresskey='the key you want'
Version 1.1.5
  • Added Shift + F8 console opening, the old one still remains (Thank you miko)
  • Everything except for settings (which has its own global table) is now put into the local table _Debug (Thank you tentus)
Version 1.1
  • Fixed the console to be hidden at the start
  • Added _OverlayColor to global settings (see _Settings() for a list of settings) Changed location as of 1.1.5 to _DebugSettings.Settings()
Version 1.0
  • Initial version
Attachments
lovedebug.lua
Version 1.2.2 (not oficial)
You can now jump to the last output
(12.92 KiB) Downloaded 258 times
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
Walz.
Prole
Posts: 13
Joined: Mon May 06, 2013 2:42 pm

Re: Debug - A whole new way of debugging your game

Post by Walz. »

Thanks for the unofficial update !
Here a little bug I found.
When I don't use a custom font, ex:

Code: Select all

require 'lovedebug'
function love.load()
end
function love.update(dt)	
end
function love.draw()
end
I get :
lovedebug.lua:175: Incorrect parameter type: expected userdata.
in function 'setFont'

I fixed it by replacing (line 175) :
love.graphics.setFont(font)
by :
if font then love.graphics.setFont(font) end
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Debug - A whole new way of debugging your game

Post by Ranguna259 »

Alright cool, so apperantly when you don't use a costum font the debugger crashes and thanks to Walz. that has now been fixed :awesome:




Let's make some changlogs for this:
Changelog
Version 1.2.3 (Not Official) by Walz.
  • Fixed a font related bug
Version 1.2.2 (Not Official) by Ranguna
  • Added a new functionality that enables you to jump right to the bottom of the console by pressing the middle mouse button.
Version 1.2.1 (Not Official) by Qcode
  • Fixed some bugs
  • Added a new functionality that autocompletes the variable to the current proposal by pressing tab
Version 1.2 (Not Official) by Qcode
  • Converted to LÖVE 0.8.0
  • Added a new functionality that enables you to change the 'f8' key to what you want by changing the _lovedebugpresskey='the key you want'
Version 1.1.5
  • Added Shift + F8 console opening, the old one still remains (Thank you miko)
  • Everything except for settings (which has its own global table) is now put into the local table _Debug (Thank you tentus)
Version 1.1
  • Fixed the console to be hidden at the start
  • Added _OverlayColor to global settings (see _Settings() for a list of settings) Changed location as of 1.1.5 to _DebugSettings.Settings()
Version 1.0
  • Initial version
Attachments
lovedebug.lua
Version 1.2.3 (Not Official)
Fixed a bug
(12.94 KiB) Downloaded 232 times
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Debug - A whole new way of debugging your game

Post by bartbes »

This is actually because the default font is only loaded upon first use, so getFont returns nil until after the first print (unless setFont is called manually, beforehand).
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Debug - A whole new way of debugging your game

Post by Ranguna259 »

bartbes wrote:This is actually because the default font is only loaded upon first use, so getFont returns nil until after the first print (unless setFont is called manually, beforehand).
Noted, so that's why checking the font before setting it fixed it
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 5 guests