diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-28 20:55:33 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-28 20:55:33 +0100 |
commit | 2a680b1095bb7cb80869d7fb60cc601cce560d54 (patch) | |
tree | 3efc529b3588b46e61d4ef11af1875a0160d8a86 | |
parent | d53a22a712fd272cac72353fceae366aa1792c5f (diff) | |
download | lua_async-2a680b1095bb7cb80869d7fb60cc601cce560d54.tar.xz |
Fix optional socket dependency
-rw-r--r-- | init.lua | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,9 +1,5 @@ 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 @@ -25,7 +21,11 @@ function lua_async.step(dtime) -- close phase is obsolete end -return function(path) +return function(path, no_socket) + if not no_socket then + lua_async.socket = require("socket") + end + for _, f in ipairs { "timeouts", "intervals", |