]> git.lizzy.rs Git - lua_async.git/commitdiff
Merge branch 'master' of https://github.com/EliasFleckenstein03/lua_async master
authorElias Fleckenstein <eliasfleckenstein@web.de>
Tue, 14 Dec 2021 17:11:51 +0000 (18:11 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Tue, 14 Dec 2021 17:11:51 +0000 (18:11 +0100)
init.lua
promises.lua

index 4de726a230ffbe85c359edfe17b8c64a8b048e99..8449a0f1e2c6d962298f08031fd29da90d9edbb0 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -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",
index 29bcdabcf374d8c38637d55144194fc68d9c4c7e..e65445831d80dd57c59d5d597c0b959e52dfaf07 100644 (file)
@@ -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