ReferenceDebug

getfunctionreferences

Finds what still refers to a function.

Syntax

getfunctionreferences(callback: function) -> {any}

Parameters

ParameterTypeDescription
callbackfunctionThe function to look for.

Returns

TypeDescription
{any}Tables that hold the function and Luau closures that capture it.

Description

It follows the same rules as getobjectreferences and accepts only a function.

Example

local box = {handler = function() end}
for _, owner in getfunctionreferences(box.handler) do
    print(owner == box)
end

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