Code Editor

Code Editor

The Code Editor is where you can write the Lua code your gadget's CPU will run. If you're a beginner at programming and want to see some code examples, you can look in the Tutorial button on the main menu for a variety of built-in gadgets you can inspect and learn from.

At the bottom of the editor, there is a status bar that will tell the runtime state of your code while your gadget is on. It can show the performance of your gadget in "tps" (Ticks Per Second), or if your gadget has encountered an error. Errors are displayed in red and can be hovered over to show more information about what happened.

At the bottom-right there are 4 buttons, respectively:

  • Debugging will show line numbers so you can click them to set breakpoints in your code to inspect it more closely. Your code will pause at the breakpoint until told to continue, and clicking the current running line will show you a stacktrace.
  • Word wrap will wrap around lines that are too long horizontally to be displayed on the screen. When disabled, a horizontal scroll bar will be shown instead.
  • Minus button will decrease the resolution of the code editor, meaning letters are bigger and less code will fit on screen at once.
  • Plus button will increase the resolution of the code editor, meaning letters are smaller and more code will fit on screen at once.

Depending on your monitor's resolution, the minus and plus buttons may not have any effect.

To learn more about how to program in Retro Gadgets, see the Glossary and Code Structure pages.