ExecuteAsync
已弃用: 此函数已弃用,请改用
ExecuteInGameThreadWithDelay。新函数支持取消、暂停/恢复和状态查询。详情请参阅迁移指南。
ExecuteAsync 函数异步执行传入的回调。
它的工作方式类似于 ExecuteWithDelay,但除了注册回调本身的开销外,没有额外延迟。
参数
| # | 类型 | 说明 |
|---|---|---|
| 1 | function | 要执行的回调 |
示例
ExecuteAsync(function()
print("Executed asynchronously\n")
end)
推荐替代方案
-- Executes on the game thread on the next frame/ProcessEvent
local handle = ExecuteInGameThreadWithDelay(0, function()
print("Executed on game thread\n")
end)
-- Can now cancel with: CancelDelayedAction(handle)
原文:docs/lua-api/global-functions/executeasync.md · 固定提交 560411f18512 · 来源与 MIT 许可