From 99ac3427209d56c787b7a2c39ce4f55559b1466c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Mon, 28 Aug 2017 12:52:20 +0200 Subject: [PATCH] Move callback to top of function --- async.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/async.lua b/async.lua index 3c7ab7c8..378dec29 100644 --- a/async.lua +++ b/async.lua @@ -33,6 +33,10 @@ end function Async.parallelLimit(tasks, limit, cb) + if #tasks = 0 then + cb(results) + end + local remaining = #tasks local running = 0 local queue = {}