To make it so you can output message to the terminal with print commands you just need the following line at the start of your main.lua file:
For full debugging (breakpoints and stepping through functions etc.) I use
https://marketplace.visualstudio.com/it ... ger-vscode
That takes a bit more setting up and my setup may not be the best, I got it going a while ago have been copying a bese template project ever since so can't quite remember which bits I did anything to and which bits I haven't.
My launch.json I use (this file should be in the .vscode subfolder of your love projects) is:
Code: Select all
{
"version": "0.2.0",
"configurations": [
{
"type": "lua-local",
"request": "launch",
"name": "Debug",
"program": {
"command": "love"
},
"args": [
".",
"debug"
],
},
{
"type": "lua-local",
"request": "launch",
"name": "Release",
"program": {
"command": "love"
},
"args": [
".",
],
},
]
}
Then in love.load() I enable the debugger like this:
Code: Select all
-- Enable debugger
debugMode = false
if arg[2] == "debug" then
require("lldebugger").start()
debugMode = true
end
Finally, for the debugger to catch errors you need to override the love error handler:
Code: Select all
local loveErrorhandler = love.errorhandler or love.errhand
function love.errorhandler(msg)
if debugMode then
error(msg, 2)
else
return loveErrorhandler(msg)
end
end