概要
方法
BindToMessage(topic: string,function: function):RBXScriptConnection |
BindToMessageParallel(topic: string,function: function):RBXScriptConnection |
SendMessage(topic: string,message: Tuple):() |
API 参考
方法
BindToMessage
代码示例
绑定到消息
local actor = script:GetActor()
-- 当发送问候消息到 Actor 时打印消息
-- 此脚本是其后代。
local connection = actor:BindToMessage("Greeting", function(message)
print("收到问候消息:", message)
end)BindToMessageParallel
代码示例
绑定到消息并行
local actor = script:GetActor()
-- 当发送问候消息到 Actor 时打印消息
-- 此脚本是 Actor 的后代。
local connection = actor:BindToMessageParallel("Greeting", function(message)
print("收到问候消息:", message)
end)