spenk

Untitled

May 2nd, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. function marqueeRight(side, text, ypos, sleep)
  2.         if peripheral.isPresent(side) then
  3.                 term.redirect(peripheral.wrap(side))
  4.                 local sx, sy = term.getSize()
  5.                 text = string.rep(" ", sx - 1)..text..string.rep(" ", sx - 1)
  6.                 for i = 1,string.len(text) - (sx - 1) do
  7.                         term.clearLine()
  8.                         displayString = string.sub(text, -math.min(string.len(text), i + sx - 2), -i)
  9.                         term.setCursorPos(1, ypos)
  10.                         write(displayString)
  11.                         os.sleep(sleep)
  12.                 end
  13.                 term.clearLine()
  14.                 term.restore()
  15.         end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment