Syntax
getcallbackvalue(instance: Instance, property: string): function | nilAliases
getcallbackmemberArguments
| Name | Type | Description |
|---|---|---|
instance | Instance | Roblox instance to inspect or update. |
property | string | Property name to read or change. |
Returns
| Name | Type | Description |
|---|---|---|
callback | function | nil | Callback function, or nil when the callback cannot be read. |
Description
Reads a callback property from an instance when the callback can be inspected.
Call it with 2 parameter(s): instance, property. The argument table explains which values are required and which ones only refine the behavior.
It returns callback (function | nil). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Read the callback assigned to a callback property such as BindableFunction.OnInvoke.
local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function(value)
return value * 2
end
local callback = getcallbackvalue(bindable, "OnInvoke")
if callback then
print(callback(21))
end