IsInAsyncThread
IsInAsyncThread 用于检查当前执行上下文所在的线程,是否为执行 ExecuteAsync、LoopAsync 及其他异步函数所注册回调的线程。
返回值
| # | 类型 | 说明 |
|---|---|---|
| 1 | boolean |
示例
-- Output: false
print(string.format("IsInAsyncThread: %s\n", IsInAsyncThread()))
ExecuteInGameThread(function()
-- Output: false
print(string.format("IsInAsyncThread: %s\n", IsInAsyncThread()))
end)
ExecuteAsync(function()
-- Output: true
print(string.format("IsInAsyncThread: %s\n", IsInAsyncThread()))
end)
原文:docs/lua-api/global-functions/isinasyncthread.md · 固定提交 560411f18512 · 来源与 MIT 许可