Studio › Manual › Debug and performance

Variables, watches and Set Value

  • Locals of the stopped function, self (the instance or struct running it), other, Globals. Structs, arrays and instances open with the arrow.
  • Click a frame in the call stack to see its code, its self and its locals. A caller's locals are as they were when it made the call that led to the stop (a called function can't change them), and they are read only.
  • After an error: with Run > Debug > Keep Locals for Errors on, every function keeps its locals on each line that calls something, so an error stop shows them (as at the failing frame's last line with a call). It costs a little speed while on, so it is off until you want it.
  • Double-click a value (or right-click > Set Value…) to change it while paused: a number, true, false, undefined or text.
  • Watch: type an expression (global.score, inventory[0].count, hp * 2, array_length(enemies), point_distance(x, y, mouse_x, mouse_y), inventory_map[? "key"], grid[# 2, 3]). Watches update when the game stops and while it runs. They can call built-in functions that only read (maths, strings, arrays, structs, instances and data structures); any other call is refused, so a watch never changes the game.
  • Studio's own types (see Studio's own types) show as they read in code: vec3(1, 2, 3), quat(0, 0, 0, 1), rect(0, 0, 10, 20), a colour with a swatch of it, and dict(…) or set(…) with how many entries they hold. Open one with the arrow for its parts (x, y, z; r, g, b, a; a dict's keys and values; a set's values). The parts are read only (these values are never changed in place: set the whole variable instead), and v.y works in a watch.

Keys are shown as on the Mac: ⌘ Command, ⌥ Option, ⌃ Control, ⇧ Shift. Studio for Windows shows its own keys beside each menu item.