diff --git a/src/moonscript/fuckedtail.moon b/src/moonscript/fuckedtail.moon index b1ebf8b..8d07654 100644 --- a/src/moonscript/fuckedtail.moon +++ b/src/moonscript/fuckedtail.moon @@ -3,13 +3,17 @@ class Buffer @limit = limit @data = {} + purge: => + if #@data > @limit + table.remove @data, 1 + @purge! + else return + add: (line) => - if #@data == @limit - table.remove @data, 0 - table.insert @data, line + @purge! -with Buffer 10 +with Buffer 5 while true n = io.read! if n ~= nil