Advertisement
Wyvern67

Logs reader

Aug 2nd, 2015
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs < 1 then
  3.         print("Usage: reader <side>")
  4.         return
  5. end
  6. side = tArgs[1]
  7. print("Ender device on the "..side)
  8. c = peripheral.wrap(side)
  9. print(e)
  10.  
  11. print("Which file shall I read ?")
  12. f = fs.open(io.read(), "r")
  13. assert(f)
  14. line = ""
  15. j = 0
  16. k = 0
  17. color = {}
  18. while true do
  19.     line = f.readLine()
  20.     if line == nil then
  21.         break
  22.     end
  23.     j = j+1
  24.     color[j] = {}
  25.     for i,v in string.gmatch(line, "%d+") do
  26.         table.insert(color[j], i)
  27.         -- k = k+1
  28.         -- color[j][(k%3)+1] = i
  29.     end
  30.     table.insert(color[j], line)
  31.    
  32.     print(2^color[j][1], 2^color[j][2], 2^color[j][3])
  33. end
  34.  
  35. for i=1,#color do
  36.     c.setColors(2^color[i][1], 2^color[i][2], 2^color[i][3])
  37.     print(color[i][4])
  38.     os.pullEvent()
  39.     while rs.getInput("front") == false do
  40.         sleep(1)
  41.     end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement