system.hasEventSource()

类型 函数
system.*
返回值 布尔值
修订版本 版本 2024.3703
关键词 system 事件

概述

根据系统是否传递与 eventName 对应的事件,返回布尔值 truefalse

语法

system.hasEventSource( eventName )
eventName (必填)

字符串. 传递该名称事件的事件源的名称 — 有关详细信息,请参阅下一节。

事件源

有效的事件源值包括

示例

local hasGyroscrope = system.hasEventSource( "gyroscope" )

if hasGyroscrope then
    print( "The device has a gyroscrope." )
end