

You can also mouse over a variable (or select an expression and mouse over it) during debugging to see its value. In addition to being able to use the Console or the Watch window to see the values of variables and expressions,
#Scratchpad coding update#
The result is equivalent to executing tbl = "new value" in the Console window, but provides an easy way to update the value without retyping the expression. You can then edit the value of the second element.Īfter entering the new value and pressing Enter, the new value will be sent to the application being debugger and will also be reflected in the Watch window. In addition to viewing the values that variables or expressions are evaluated to, you may also change the values of those variables or expressions and those changes will be reflected in the current stack frame of the application.įor example, if tbl is a table with three values ( ), you can expand the table, right click on the second element, and select Edit Value. You can also drill down to get values of individual elements in tables. The Watch window provides a convenient way to evaluate variables and expressions after every stopping in the debugger. You can even drill down to get values of individual elements in tables. The Stack window provides not only the call stack with function names, but also presents all local variables and upvalues for each of the stack frames. You can also do =expression to pretty print the results in the block form. You can execute any expression in the console and the result will be pretty printed for you.
#Scratchpad coding code#
It will switch automatically between a local console that gives you access to the Lua interpreter that runs the IDEĪnd a remote console that allows you to execute code fragments and change variable values in your application when it is stopped in the debugger. The Console window allows to run Lua code fragments and calculate values of Lua expressions.

Please consult live coding tutorials for details. Your code may also need to be written in a way that accomodates requirements of those engines. Note that this functionality is highly interpreter dependent and some interpreters may not provide it at all (for example, Corona) and some may provide in a way that doesn’t restart the entire application (for example, LÖVE, Moai, or Gideros interpreters). To exit the scratchpad mode you can close the application, go to Project | Stop Process, or go to Project | Run as Scratchpad. If you make an error (whether a compile or run-time), it will be reported in the Output window. In addition to regular editing, you can also mouse over a number (all the number in your script will be underlined as you can see in the screenshot on the right) and drag a virtual sliders left or right to change the value of that number. You will continue to have access to the editor tab from which the scratchpad has been started and all the changes you make will be seen in your application. To enable this mode go to Project | Run as Scratchpad (when it is available) and your program will be started as during debugging. Live coding (also known as Running as Scratchpad) is a special debugging mode that allows for the changes you make in the editor to be immediately reflected in your application. Run to cursor location ( Project | Run To Cursor),Īnd continue execution of your program (using Project | Continue). View the call stack using the Stack window ( View | Stack Window), Inspect variables using the Watch window ( View | Watch Window),

Step through the code (using Project | Step Into, Project | Step Over, and Project | Step Out commands), When the debugger is stopped, you can set/remove breakpoints (using Project | Toggle Breakpoint), When your program is running, you can pause it by going to Project | Break, which will stop your program at the next lua command executed. To start debugging go to Project | Start Debugging.ĭepending on your interpreter configuration, the debugger may stop your program on the first instruction (this is a default for most interpreters) or may execute it immediately (as configured for Moai and Corona interpreters).

The debugger allows to execute Lua scripts and applications step by step, pause them, inspect variables, evaluate expressions, make changes to variables, and then continue execution.
