World External · Luau VM

Debug Library

Inspect and mutate function info and upvalues at runtime.

Overview

Function introspection for the External's own Luau VM. This reads your code, not the game's — there is no Roblox VM to reach into from out here.

It is most useful for tooling: inspecting a callback a script handed you, or reading the state a closure captured.

Reading a closure
local function make(threshold)
    return function(value) return value > threshold end
end

local check = make(100)
print(debug.getinfo(check).nups)

for i, value in pairs(debug.getupvalues(check)) do
    print(i, value)          --> 1  100
end
debug.setupvalue(check, 1, 5)
print(check(10))             --> true

Reference