Yuari
Documentation
Docs/Script/getfunctionreferences

getfunctionreferences(fn)

Walks the GC heap and returns tables that directly hold the function.

Syntax

getfunctionreferences(fn: function) -> {table}

Parameters

ParameterTypeDescription
fnfunctionFunction to search for.

Returns

TypeDescription
{table}Tables whose array or hash part references the function.

Description

Same heap walk as getobjectreferences, restricted to function values.

Useful for finding which table an executor or game script captured a callback in.

Example

local box = { holder = { function() end } }
local refs = getfunctionreferences(box.holder[1])
print(table.find(refs, box.holder) ~= nil)