diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-21 16:37:08 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-21 16:37:08 +0100 |
commit | 40beef755f0c47691b5cd5a79e76fdd361320aa8 (patch) | |
tree | 023dc702cab44be6b500dc0f1ef549090498e9b6 /init.lua | |
parent | d8c45339fcef6609dcc423480dcb70986237bf61 (diff) | |
download | lua_async-40beef755f0c47691b5cd5a79e76fdd361320aa8.tar.xz |
Sleep for unused tick time & optional realtime
- Optional luasocket dependency for realtime measurements (instead of CPU time)
- lua_async.run() will wait for the time to be ready
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1,5 +1,13 @@ lua_async = {} +if rawget(_G, "require") then + lua_async.socket = require("socket") +end + +function lua_async.clock() + return lua_async.socket and lua_async.socket.gettime() or os.clock() +end + function lua_async.step(dtime) -- timers phase lua_async.timeouts.step(dtime) |