util.timer: More small fixes I forgot to commit

Thu, 26 Feb 2009 22:17:55 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 26 Feb 2009 22:17:55 +0000
changeset 842
4932f94d35c1
parent 841
77ff000c2055
child 843
1d2dab41b0db

util.timer: More small fixes I forgot to commit

util/timer.lua file | annotate | diff | comparison | revisions
--- a/util/timer.lua	Thu Feb 26 21:00:42 2009 +0000
+++ b/util/timer.lua	Thu Feb 26 22:17:55 2009 +0000
@@ -32,18 +32,16 @@
 ns_addtimer(function()
 	local current_time = get_time();
 	if #new_data > 0 then
-		for _, d in ipairs(new_data) do
+		for _, d in pairs(new_data) do
 			t_insert(data, d);
 		end
 		new_data = {};
-	elseif #data == 0 then
-		return;
 	end
 	
 	for i, d in pairs(data) do
 		local t, func = d[1], d[2];
 		if t <= current_time then
-			t_remove(data, i);
+			data[i] = nil;
 			local r = func();
 			if type(r) == "number" then _add_task(r, func); end
 		end

mercurial