Hello, guys.
Does anyone know how to trap an error for debugging? I'm kinda fighting to hunt down some bugs in my project but sometimes I can't understand why any of them are happening...
Thanks
Error debug
Error debug
Code games. You'll have fun!
Re: Error debug
The Debug Library should have all of what you're looking for in advanced debugging tools. Also handy is the assert function.
A good tactic I do, which requires you turn on the windows console in the config, is put informative print messages in key spots. Anywhere there might be a loop going and you don't want to see tons of spam in that console, use this function instead:
A good tactic I do, which requires you turn on the windows console in the config, is put informative print messages in key spots. Anywhere there might be a loop going and you don't want to see tons of spam in that console, use this function instead:
Code: Select all
function log(...)
if love.keyboard.isDown("rctrl") then
print(...)
end
end
- Jasoco
- Inner party member
- Posts: 3727
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: Error debug
Or if you're on OS X or Linux you simply run the project through the love binary located inside the application package. Does the same thing except that it prints to the Terminal instead of a built-in console window.
For instance on OS X:
You then use the print() (Not love.graphics.print()) function in Lua to print messages to the console like mentioned above.
For instance on OS X:
Code: Select all
/Path/To/love.app/Contents/MacOS/love /Path/To/Project/Love/File/
Re: Error debug
Thank you, guys. I'm very appreciate. I'll try this library.
Code games. You'll have fun!
Re: Error debug
If you're a windows user, the love studio debugger (https://bitbucket.org/kevinclancy/love-studio/downloads) traps errors. It works pretty well for debugging locals and upvalues, but not globals.
Who is online
Users browsing this forum: Google [Bot] and 5 guests