fix fuckedtail

This commit is contained in:
Christine Dodrill 2015-06-15 16:23:02 -07:00
parent aa1a2ec9a1
commit 7317e44760
1 changed files with 8 additions and 4 deletions

View File

@ -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