KaoSDlanor

marquee

May 1st, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local function scroll(str,maxlen)
  2.     str=str:sub(-1,-1)==" " and str or str.." "
  3.     local scrolled=0
  4.     while true do
  5.         scrolled=scrolled%#str+1
  6.         term.setCursorPos(1,1)
  7.         write(str:rep(math.ceil((maxlen+scrolled)/str:len())):sub(scrolled,maxlen+scrolled))
  8.         sleep(0.1)
  9.     end
  10. end
  11.  
  12. scroll("hello, this is a test",10)
Advertisement
Add Comment
Please, Sign In to add comment