ไวยากรณ์
getcallbackvalue(instance: Instance, property: string): function | nilAliases
getcallbackmemberArguments
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
instance | Instance | อินสแตนซ์ Roblox เพื่อตรวจสอบหรืออัปเดต |
property | string | ชื่อคุณสมบัติที่จะอ่านหรือเปลี่ยนแปลง |
Returns
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
callback | function | nil | ฟังก์ชั่นการโทรกลับหรือไม่มีเมื่อไม่สามารถอ่านการโทรกลับได้ |
คำอธิบาย
อ่านคุณสมบัติการโทรกลับจากอินสแตนซ์เมื่อสามารถตรวจสอบการโทรกลับได้
เรียกด้วย parameter 2 ค่า: instance, property ตาราง arguments อธิบายค่าที่จำเป็นและค่าที่ปรับพฤติกรรม
ส่งคืน callback (function | nil) ใช้ตาราง returns เพื่อแยกค่าที่สำเร็จ ผลลัพธ์ nil และ error ที่จัดการต่อได้
ตัวอย่าง
อ่านการโทรกลับที่กำหนดให้กับคุณสมบัติการโทรกลับ เช่น BindableFunction.OnInrigg
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