debug.setinfo
Changes selected debug metadata on a Luau function or proto.
Syntax
debug.setinfo(func_or_level: function | number | ProtoProxy, info: table) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
func_or_level | function, stack level, or ProtoProxy | Luau proto to modify |
info | table | Metadata fields to assign |
Supported Fields
| Field | Type | Description |
|---|---|---|
source | string | Full source identifier |
short_src | string | Replacement source identifier that preserves a leading = or @ marker |
name | string | Function debug name |
currentline | number | Function definition line |
If both source and short_src are present, source takes precedence.
Example
local function example()
return true
end
debug.setinfo(example, {
source = "@custom/example.luau",
name = "renamed_example",
currentline = 25,
})
local info = debug.getinfo(example)
print(info.source) -- @custom/example.luau
print(info.name) -- renamed_example
print(info.currentline) -- 25Notes
- C closures are rejected
Related Functions
debug.getinfo- Read debug metadatadebug.getproto- Access nested protos