mjmac85

Lua reading 2

Dec 2nd, 2014
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.56 KB | None | 0 0
  1. -- set up monitor
  2. attachedMonitor = peripheral.wrap("right")
  3. attachedMonitor.setBackgroundColor(colors.black)
  4. attachedMonitor.setTextColor(colors.white)
  5. attachedMonitor.setTextScale(.5)
  6. attachedMonitor.clear()
  7.  
  8.  
  9.  
  10.  
  11. local file = 'db'
  12.  
  13. local x = 3
  14. local y = 5
  15.  
  16. --local f = io.open(file, "rb")
  17. lines = {}
  18. data = {}
  19. i = 2
  20. for line in io.lines(file) do
  21.     data[i] = line
  22.     i = i + 1
  23. end
  24. data[1] = i
  25.  
  26. for i=2,data[1] do
  27.     attachedMonitor.setCursorPos(x,y)
  28.     attachedMonitor.write(line)
  29.     y = y + 1
  30. end
  31.  
  32. --attachedMonitor.write(lines)
Advertisement
Add Comment
Please, Sign In to add comment