diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-08-06 19:38:39 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-08-06 19:38:39 +0200 |
commit | c3909348044e26d642e4c7f196eb27f1f6255eda (patch) | |
tree | cd7069a691432c92c1ceba4164fed3716066860a /util.lua | |
parent | a2770298f040307f8dd59c7a88d7e40d37faec14 (diff) | |
download | lua_async-c3909348044e26d642e4c7f196eb27f1f6255eda.tar.xz |
Add lua_async.run
Diffstat (limited to 'util.lua')
-rw-r--r-- | util.lua | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -11,3 +11,15 @@ function lua_async.sleep(ms) setTimeout(resolve, ms) end)) end + +function lua_async.run() + local last_time = os.clock() + + while true do + local current_time = os.clock() + local dtime = current_time - last_time + last_time = current_time + + lua_async.step(dtime) + end +end |