Implement a fucked tail

This commit is contained in:
Christine Dodrill 2015-06-15 16:04:33 -07:00
parent be18a0a148
commit 65c265cb62
1 changed files with 20 additions and 0 deletions

20
src/fuckedtail.moon Normal file
View File

@ -0,0 +1,20 @@
class Buffer
new: (limit = 5) =>
@limit = limit
@data = {}
add: (line) =>
if #data == @limit
table.remove @data, 0
table.insert @data, line
b = Buffer!
while true
n = io.read!
if n ~= nil
b\add(n)
else break
for _, i in pairs b\data
print i