debug.setinfo Synchronous

  • setinfo

Update the supported debug metadata of a Luau function or frame. It is useful for giving a generated function a clearer name or source label in later diagnostics.

Syntax
Luau
debug.setinfo(target: DebugTarget, info: DebugInfoUpdate) -> ()

Parameters

Function parameters
ParameterTypeDescription
targetDebugTargetA Luau function, visible stack level, or ProtoProxy. Indexes in these APIs start at 1.
infoDebugInfoUpdateTable containing supported source, short_src, name, or currentline fields.

Argument fields

DebugTarget fields
Luau
DebugTarget = Function | number | ProtoProxy
DebugInfoUpdate fields
Luau
DebugInfoUpdate = {source: string?, short_src: string?, name: string?, currentline: number?}

Returns

()

No value.

Usage notes

Only supported metadata fields are applied; this does not rewrite executable code.

Example

Example
Luau
local function generated() end
debug.setinfo(generated, { name = "generated handler" })
print(debug.getinfo(generated).name)
Kawaii documentation