RakNet

RakNet.is_enabled

Boolean field on the RakNet table.

语法

RakNet.is_enabled(): boolean
别名 raknet.is_enabled

返回值

名称类型描述
enabledbooleantrue when the RakNet API surface was registered for this session; false otherwise.

说明

Boolean field on the RakNet table. It is true only when RakNet support is enabled for the current Real session. When it is false, the RakNet table is still present, but the send, hook, signal, priority, and reliability fields are not registered.

无需参数即可调用。函数会从当前 runtime 状态读取所需上下文。

返回 enabled (boolean)。使用返回表区分成功值、nil 结果和可恢复错误。

示例

Check whether the RakNet API surface is available before reading RakNet methods or enum tables.

if not RakNet.is_enabled then
    warn("RakNet is disabled")
    return
end

print(RakNet.is_enabled)