diff options
Diffstat (limited to 'script-beta/await.lua')
-rw-r--r-- | script-beta/await.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua index c00e27e0..a26adff8 100644 --- a/script-beta/await.lua +++ b/script-beta/await.lua @@ -9,6 +9,7 @@ m.coMap = setmetatable({}, { __mode = 'k' }) m.idMap = {} m.delayQueue = {} m.delayQueueIndex = 1 +m._enable = true --- 设置错误处理器 ---@param errHandle function {comment = '当有错误发生时,会以错误堆栈为参数调用该函数'} @@ -127,6 +128,9 @@ end --- 延迟 function m.delay() + if not m._enable then + return + end if not coroutine.isyieldable() then return end @@ -169,4 +173,12 @@ function m.setPriority(n) m.coMap[coroutine.running()].priority = true end +function m.enable() + m._enable = true +end + +function m.disable() + m._enable = false +end + return m |