Advertisement
OldDragon2A

show text

Feb 18th, 2013
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local function writeFileToMonitor(side, file)
  2.   if not fs.exists(file) then
  3.     print("File Not Found")
  4.     return
  5.   end
  6.  
  7.   local monitor = peripheral.wrap(side)
  8.   monitor.clear()
  9.  
  10.   local handle = fs.open(file, "r")
  11.   local line = handle.readLine()
  12.   while line ~= nil do
  13.     monitor.write(line .. "\n")
  14.     line = handle.readLine()
  15.   end
  16.   handle.close()
  17. end
  18.  
  19. local args = { ... }
  20. if #args == 2 then
  21.   writeFileToMonitor(args[1], args[2])
  22. else
  23.   print("Usage: toMonitor <side> <file>")
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement