getcallbackmember / getcallbackvalue
Gets the value assigned to an object callback property.
Syntax
getcallbackmember(object: Object, property: string, returnRaw?: boolean) -> any?
getcallbackvalue(object: Object, property: string, returnRaw?: boolean) -> any? -- aliasParameters
| Parameter | Type | Description |
|---|---|---|
object | Object | The object, including an Instance |
property | string | The callback property name |
returnRaw | boolean? | Return a non-function callback object instead of filtering it to nil |
Returns
| Type | Description |
|---|---|
any? | The callback value, or nil when no callback is assigned |
Description
getcallbackvalue reads async callback properties such as BindableFunction.OnInvoke that are normally exposed as write-only. By default, values that are not functions are returned as nil; pass true to retrieve the raw callback object.
The canonical function name is getcallbackmember; getcallbackvalue is an alias.
Example
-- Create a BindableFunction
local bindable = Instance.new("BindableFunction")
bindable.OnInvoke = function(arg)
return arg * 2
end
-- Get the callback
local callback = getcallbackvalue(bindable, "OnInvoke")
if callback then
print(callback(5)) -- 10
endInspecting Remote Callbacks
-- Find RemoteFunction callbacks
for _, obj in ipairs(game:GetDescendants()) do
if obj:IsA("RemoteFunction") then
local callback = getcallbackvalue(obj, "OnClientInvoke")
if callback then
print("Found callback on:", obj:GetFullName())
end
end
endNotes
- Common callback properties include
OnInvoke,OnClientInvoke, andOnServerInvoke - Returns nil if no callback is set