diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-14 18:11:51 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-14 18:11:51 +0100 |
commit | 6fcf6209e05410d5ac077ecce6c940197d430c8a (patch) | |
tree | 77ce39cedae470dc21f564195cf9bad448bb3a20 | |
parent | 3c41b0adf7a3175fd7be50d723d51d20f36768d8 (diff) | |
parent | 21b795f826f5d2d36d45677f1e6c4118ef850846 (diff) | |
download | lua_async-master.tar.xz |
-rw-r--r-- | init.lua | 10 | ||||
-rw-r--r-- | promises.lua | 1 |
2 files changed, 6 insertions, 5 deletions
@@ -2,10 +2,6 @@ lua_async = { poll_functions = {}, } -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 @@ -30,7 +26,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", diff --git a/promises.lua b/promises.lua index 29bcdab..e654458 100644 --- a/promises.lua +++ b/promises.lua @@ -39,6 +39,7 @@ function PromisePrototype:__reject_raw(reason) local any_child = false for _, child in ipairs(self.__children) do + any_child = true child:reject(reason) end |