Clear

From ComputerCraft Wiki
Revision as of 16:44, 2 September 2012 by YoYoYonnY (Talk | contribs) (Created page with " == Clear == Clear is a program in computercraft. You may want to use it in a script like: shell.run('clear') print 'Your screen is emtpy new!' This clears the screen so ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Clear

Clear is a program in computercraft. You may want to use it in a script like:

 shell.run('clear')
 print 'Your screen is emtpy new!'

This clears the screen so you can write a text

Clear is usefull becaus you don't have to enter a code like:

 if turtle then
  print 'Your screen is emtpy new!'
  i = 0
  repeat
   print ' '
   i = i + 1
  until i == 11
 else
  print 'Your screen is emtpy new!'
  i = 0
  repeat
   print ' '
   i = i + 1
  until i == 17
 end

You see, a huge code! New lets use a api that generate like clear:

 term.setCursorPos(term.getCursorPos)
 term.clear()
 term.setCursorPos(1,1)

a smaller code and it works for Turtle AND CraftOS