diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-09-18 19:43:12 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-09-18 19:43:12 +0800 |
commit | 9a64c553de80531c9ef8c53a84754ec35fccff91 (patch) | |
tree | 77c2138cdd99161582bf1cb2df2fe3c5a4b99c98 /script-beta/await.lua | |
parent | 1d512d14481843c20a0760af6f2f19c6ad497861 (diff) | |
download | lua-language-server-9a64c553de80531c9ef8c53a84754ec35fccff91.zip |
修正一个测试问题
Diffstat (limited to 'script-beta/await.lua')
-rw-r--r-- | script-beta/await.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/script-beta/await.lua b/script-beta/await.lua index b8c6ac17..9da40027 100644 --- a/script-beta/await.lua +++ b/script-beta/await.lua @@ -53,6 +53,9 @@ end --- 创建一个任务,并挂起当前线程,当任务完成后再延续当前线程/若任务被关闭,则返回nil function m.await(callback, ...) + if not coroutine.isyieldable() then + return callback(...) + end return m.wait(function (waker, ...) m.call(function () local returnNil <close> = util.defer(waker) |