aboutsummaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua8
1 files changed, 3 insertions, 5 deletions
diff --git a/util.lua b/util.lua
index 852b933..e7c6cbf 100644
--- a/util.lua
+++ b/util.lua
@@ -1,9 +1,7 @@
function lua_async.yield()
- local co = assert(coroutine.running(), "yield called outside of an async function")
-
- setTimeout(lua_async.resume, 0, co)
-
- coroutine.yield()
+ await(Promise(function(resolve)
+ setImmediate(resolve)
+ end))
end
function lua_async.kill_thread()