aboutsummaryrefslogtreecommitdiff
path: root/util.lua
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-08-06 20:46:55 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-08-06 20:46:55 +0200
commit457e91a5eeba4a211fc0abdaf0e8fb200ec0dfb9 (patch)
tree4810250b0c2898813ef2a07ddb8a279455b4868b /util.lua
parent96c25df59c02f51ea2f43d06b886ef3cc623e336 (diff)
downloadlua_async-457e91a5eeba4a211fc0abdaf0e8fb200ec0dfb9.tar.xz
Add lua_async.kill_thread
Diffstat (limited to 'util.lua')
-rw-r--r--util.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/util.lua b/util.lua
index b5c7043..852b933 100644
--- a/util.lua
+++ b/util.lua
@@ -6,6 +6,10 @@ function lua_async.yield()
coroutine.yield()
end
+function lua_async.kill_thread()
+ coroutine.yield(true)
+end
+
function lua_async.sleep(ms)
await(Promise(function(resolve)
setTimeout(resolve, ms)