ReferenceDebug

debug.setinfo

Changes the name that debug.info(target, "n") reports.

Syntax

debug.setinfo(target: function, info: {name: string}) -> ()

Also available as

setinfo

Parameters

ParameterTypeDescription
targetfunctionFunction whose reported name changes.
info{name: string}Fields to set. Only name is applied.

Returns

TypeDescription
()Nothing.

Description

The name belongs to the function's prototype, so every closure made from that prototype reports it. Fields other than name are ignored.

Example

local function work() end
debug.setinfo(work, {name = "renamed"})
print(debug.info(work, "n"))

These are Game executor contracts. Check build requirements and session lifetimes before using them.