getfunctionreferences(fn)
Walks the GC heap and returns tables that directly hold the function.
Syntax
getfunctionreferences(fn: function) -> {table}
Parameters
| Parameter | Type | Description |
|---|---|---|
fn | function | Function to search for. |
Returns
| Type | Description |
|---|---|
{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)