Skip to content

Commit

Permalink
Allow dequeue again for "new" function also
Browse files Browse the repository at this point in the history
  • Loading branch information
HHHartmann committed Feb 18, 2024
1 parent 47a1f63 commit ab87b02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lua_modules/fifo/fifo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ local function dequeue(q, k)
local new, again = k(q[1], #q == 1)
if new == nil then
tableRemove(q, 1)
if again then
return dequeue(q, k)
end -- note tail call
else
q[1] = new
end
if again then
return dequeue(q, k)
end -- note tail call
return true
else
q._go = true
Expand Down

0 comments on commit ab87b02

Please sign in to comment.