Skip to content

Commit

Permalink
Re-use code
Browse files Browse the repository at this point in the history
I cannot see any problems with this change. Maybe I am overlooking something obvious...
  • Loading branch information
hbomb79 committed Dec 10, 2015
1 parent 1a8afa3 commit d79b826
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/lib/timer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,7 @@ end
function timer.queue( n, response )
parameters.check( 2, "n", "number", n, "response", "function", response )

local finish, ID = t + n, false -- avoids duplicating timer events
for i = 1, #timers do
if timers[i].time == finish then
ID = timers[i].ID
break
end
end

local timerID = ID or os.startTimer( n )
local timerID = timer.new( n )
timers[#timers + 1] = { time = finish, response = response, ID = timerID }
return timerID
end
Expand Down

0 comments on commit d79b826

Please sign in to comment.