getcallbackvalue

Reads an instance callback.

Syntax

Signature
getcallbackvalue(Instance: Instance, Name: string) -> function?

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
InstanceInstanceInstance table to inspect.
NamestringCallback property name.

Returns

TypeDescription
function?Stored callback, or nil when no supported callback is found.

Notes

If a normal property lookup returns nil, also checks native callback storage for supported invoke callbacks. A non-nil property that is not a function raises an error.

Example

Luau
local Event = Instance.new("BindableFunction")
Event.OnInvoke = function() return 42 end
local Callback = getcallbackvalue(Event, "OnInvoke")
if Callback then print(Callback()) end