diff options
-rw-r--r-- | scripts/lua/libmana.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/lua/libmana.lua b/scripts/lua/libmana.lua index dc58751a..7084216e 100644 --- a/scripts/lua/libmana.lua +++ b/scripts/lua/libmana.lua @@ -342,6 +342,7 @@ end -- them when they are repeated jobs. function check_schedule() if #scheduler_jobs==0 then return end + while os.time() > scheduler_jobs[#scheduler_jobs][0] do -- retreive the job and remove it from the schedule job = scheduler_jobs[#scheduler_jobs] @@ -352,6 +353,10 @@ function check_schedule() end -- execute the job job[1]() + + -- avoid looping on an empty table + if #scheduler_jobs==0 then return end + end end |