Debugging

Breaking

Love Studio can be used for debugging as well as editing. Pressing F5 will launch your project with the debugger activated. If a lua error occurs while you are debugging, you will be presented with the love studio debug interface rather than love's typical stack trace over cornflower blue. It looks like this:

breaking_1.png

Note how the values of all local variables are displayed in the upper portion of the right pane. If a variable references a table which has keys, the keys are listed when the user clicks on the + icon next to the table variable. Unfortunately, the debugger currently has no means of interacting with metatables.

Clicking on the upvalues and globals tabs allows you to browse those as well.

breaking_2.png

Once you have finished debugging, press F5 to exit debugging mode; this will allow you to resume coding and fix whatever error occurred.

Call Stack Browsing

The lower portion of the right pane displays the call stack. Clicking on an item in the call stack opens up the corresponding source file and location and displays all of the local variables of the stack frame chosen.

stack_browsing_1.png

Breaking on Errors in Coroutines

If an error occurs in a coroutine while it is executing, the debugger will not break. Instead, the default behavior of returning an error message to the resume point will happen. To view the error in love studio's debugger, we use a special function:

love.debugger.debugThread(coroutine,error)

If an error is detected, call debugThread. Pass the coroutine in as the first argument and its error message as the second. For example:

  local ret,err = coroutine.resume(foo, dt)
  
  if err ~= nil then
    love.debugger.debugThread(foo,err)
    love.event.quit() -- quit the game
  end

Updated

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.