workshit/src/moonscript/fuckedtail.moon

22 lines
303 B
Plaintext
Raw Normal View History

2015-06-15 23:04:33 +00:00
class Buffer
new: (limit = 5) =>
@limit = limit
@data = {}
add: (line) =>
if #data == @limit
table.remove @data, 0
table.insert @data, line
2015-06-15 23:13:57 +00:00
with Buffer 10
while true
n = io.read!
if n ~= nil
\add n
else
break
2015-06-15 23:04:33 +00:00
2015-06-15 23:13:57 +00:00
for _, i in pairs .data
print i