VINDICTA
Debug · Library
Bunni.fun
ChocoSploit
Cryptic
Potassium
Seliware
SirHurt
Solara
Velocity
Volcano
Volt
Wave
Xeno

debug.getinfo

Returns debugger information about a function or stack level.

function debug.getinfo(func: function | number): DebugInfo

Synopsis

How it works

Returns a table of debug metadata extracted from the closureClosureA function value that captures its lexical environment. In Luau, closures come in two types: LClosure (Luau bytecode + Proto + upvalues) and CClosure (native C function pointer + upvalues).’s Proto struct (Luau) or lua_CFunction metadata (C closures).

Fields — Luau closures

For LClosures, the data comes from the Proto and its debug info:
FieldSourceExample
sourceProto->source"=Players.Player.PlayerScripts.Script"
short_srcTruncated source"[string "...""]"
nameDebug name hint"onCharacterAdded"
numparamsProto->numparams2
nupsProto->nups3
is_varargProto->is_vararg1
currentlinePC → line mapping42
For CClosures, only source = "[C]", what = "C", and name are available.

Usage

Inspect a function
local function foo()
	print("Hello, world!")
end
for k, v in pairs(debug.getinfo(foo)) do
	print(k, v)
end

Parameters

func function | number
A Luau function or stack level.

Returns

DebugInfo Table of debug metadata fields.