Volt

Debug

The Debug library provides functions for runtime inspection of Luau functions, including access to constants, upvalues, protos, and stack values.

Overview

These functions allow you to:

  • Inspect function internals (constants, upvalues, protos)
  • Modify function behavior at runtime
  • Access the call stack

Available Functions

FunctionDescription
debug.getcallstackGet the current call stack
debug.getconstantGet a constant from a function
debug.getconstantsGet all constants from a function
debug.getinfoGet information about a function
debug.getprotoGet a proto (nested function) from a function
debug.getprotosGet all protos from a function
debug.getstackGet a value from the stack
debug.getupvalueGet an upvalue from a function
debug.getupvaluesGet all upvalues from a function
debug.setconstantSet a constant in a function
debug.setstackSet a value on the stack
debug.setupvalueSet an upvalue in a function
debug.validlevelCheck if a stack level is valid

Terminology

Constants

Values embedded directly in the function's bytecode. These include:

  • String literals
  • Numbers
  • Booleans
  • nil

Upvalues

Variables captured from the enclosing scope. When a function references a variable from outside its own scope, that variable becomes an upvalue.

Protos

Nested function definitions within a function. These are the "prototypes" of inner functions.

Stack

The call stack containing local variables and temporary values for the current execution context.

On this page