diff --git a/async.lua b/async.lua index bb5682b..34fd52f 100644 --- a/async.lua +++ b/async.lua @@ -75,7 +75,7 @@ function extended_api.Async.iterate(pool,from,to,func,callback) local maxtime = pool.maxtime for i = from, to do local b = func(i) - if b and b == false then + if b ~= nil and b == false then break end if minetest.get_us_time() * 1000 > last_time + maxtime then @@ -96,7 +96,7 @@ function extended_api.Async.foreach(pool,array, func, callback) local maxtime = pool.maxtime for k,v in ipairs(array) do local b = func(k,v) - if b and b == false then + if b ~= nil and b == false then break end if minetest.get_us_time() * 1000 > last_time + maxtime then @@ -117,7 +117,7 @@ function extended_api.Async.do_while(pool,condition_func, func, callback) local maxtime = pool.maxtime while(condition_func()) do local c = func() - if c and c ~= condition_func() then + if c ~= nil and c ~= condition_func() then break end if minetest.get_us_time() * 1000 > last_time + maxtime then @@ -137,10 +137,7 @@ function extended_api.Async.register_globalstep(pool,func) local last_time = minetest.get_us_time() * 1000 local dtime = last_time while(true) do - local c = func(dtime) - if c and c == false then - break - end + func(dtime) dtime = minetest.get_us_time() * 1000 -- 0.05 seconds if minetest.get_us_time() * 1000 > last_time + 50 then @@ -159,7 +156,7 @@ function extended_api.Async.chain_task(pool,tasks,callback) local maxtime = pool.maxtime for index, task_func in pairs(tasks) do local p = task_func(pass_arg) - if p then + if p ~= nil then pass_arg = p end if minetest.get_us_time() * 1000 > last_time + maxtime then @@ -188,7 +185,7 @@ function extended_api.Async.queue_task(pool,func,callback) if task_func and task_func.func then pass_arg = nil local p = task_func.func(pass_arg) - if p then + if p ~= nil then pass_arg = p end if task_func.callback then diff --git a/colddb.lua b/colddb.lua index 4160430..1acc842 100644 --- a/colddb.lua +++ b/colddb.lua @@ -385,7 +385,7 @@ local function iterate(db,func_on_iterate,end_func,count,cs,args) local line = fl:read("*l") if args.do_not_skip_removed_items or not db.indexes_pool[cs].deleted_items[line] then local ar = func_on_iterate(line,i,args) - if ar then + if ar ~= nil then args = ar return args end