RakNet

RakNet.remove_receive_hook

Removes a receive hook previously registered with the same callback closure.

语法

RakNet.remove_receive_hook(callback: function)
别名 raknet.remove_receive_hook

参数

名称类型描述
callbackfunctionThe callback closure to remove from incoming packet hooks.

说明

Removes a receive hook previously registered with the same callback closure. The function returns no values whether or not a matching hook was present.

使用 1 个参数调用: callback。参数表会说明哪些值必填,哪些值只用于细化行为。

不返回数据。将调用视为一个动作,并在调用点附近处理错误。

示例

Remove a receive hook by passing the same callback closure that was registered.

local function onReceive(packet)
    print(packet.Size)
end

if raknet.is_enabled then
    raknet.add_receive_hook(onReceive)
    raknet.remove_receive_hook(onReceive)
end