kikito/cron.lua — pull request #5 by hahawoo (2012-10-28 05:00:56+00:00)
Title: And now the loop works too :D

I am so sorry! I did test it... but... it seems I didn't test the number of entries, which is one of the most obviously important tests to do. Ooops.

The error I made was removing from "entry" (the actual entry) instead of "entries" (the table of entries):

```lua
if entry:update(dt) then entry[id] = nil end
```
instead of
```lua
if entry:update(dt) then entries[id] = nil end
```

I tested it again by temporarily creating a new function...
```lua
function cron.entries()
local i = 0
for _, _ in pairs(entries) do
i = i + 1
end
return i
end
```

And then running this...
```lua
cron = require 'cron'

function love.load()
t = {}

for i = 1, 1000 do
t[i] = cron.after(math.random(10), function() end)
end
end

function love.update(dt)
cron.update(dt)
print(cron.entries())
end
```

And the results were as expected. I also ran it through the Telescope tests as well, and I think everything passed.

Again, sorry for not testing thoroughly enough before sending the pull request!