A debugger is a tool that allows you to inspect your Lua code as it is run by the Lua interpreter. It is part of your IDE, and helps to see what is happening in your code. It is invaluable for diagnosing bugs, and tracking down problems in larger programs. Here we will use a small program to print out the numbers from 1 - 10 as a way to learn how to use the debugger.
Enter the following Lua program into a new file and save it.
-- Debugging.
local count = 1
while count <= 10 do
io.write(count .. " ")
count = count + 1
end
io.write("\n")
In your IDE, you need to enable the Stack window so you can see the values of
variables in your program as you debug it. This is a one off thing, and can be
done by pressing Ctrl + Shift + S or by navigating to the View menu and clicking
on the Stack Window.
This will open a floating window over your IDE. This is not too helpful, so it is
best to dock this window on the left hand side of the IDE with the Project and
Outline tabs. Go ahead and drag the stack window to those tabs. Your IDE should
now look like this:

To debug our program we need to tell the debugger where in our Lua code we want
it to stop execution. We do this by setting a breakpoint on the line we want
to debug from. Do this by clicking on the line you want to set the breakpoint on
(in our case the line that says local count = 1). Then click the red circle
icon on the toolbar. This should make a big red circle appear next to the line
number in margin like this:

You are now ready to debug your program!
Click the single green arrow on the toolbar (or press F5 on the keyboard). This will start your program with the debugger running. Execution of your program will stop on the lien that has the breakpoint on it. From here you can look at the contents of variables in the Stack Window. You can advance the debugger by one line by clicking on the Step into icon on the toolbar (or pressing F10 on the keyboard). As the program advances line by line, a green arrow will show the current line to be run next.

You can set as many breakpoints as you like in a program. Using the icons on the toolbar, you can step over lines, step into functions (we'll cover functions later), run to the cursor, and start running the program again.