summaryrefslogtreecommitdiff
path: root/script-beta/await.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-10-22 20:01:37 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-10-22 20:01:37 +0800
commit9fa30f145071d6b7059a017c406649f049c03eee (patch)
treef9b18bfacd5900ddcbe584c6f5e76148acc0583a /script-beta/await.lua
parent969cc263b08d56be0f293bd9488e92e5ae437adb (diff)
downloadlua-language-server-9fa30f145071d6b7059a017c406649f049c03eee.zip
修改限制
Diffstat (limited to 'script-beta/await.lua')
-rw-r--r--script-beta/await.lua12
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