getcallbackvalue
Reads an instance callback.
Syntax
Signature
getcallbackvalue(Instance: Instance, Name: string) -> function?Aliases
This function has no aliases.
Parameters
| Parameter | Type | Description |
|---|---|---|
Instance | Instance | Instance table to inspect. |
Name | string | Callback property name. |
Returns
| Type | Description |
|---|---|
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