Guest User

print.lua

a guest
Dec 29th, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.45 KB | None | 0 0
  1. local args = {...}
  2. if not args[2] then
  3.     error('Specify a modem!')
  4. end
  5. if not peripheral.wrap(args[2]) then
  6.     error('Modem not found!')
  7. end
  8. if peripheral.getType(args[2]) ~= 'modem' then
  9.     error('Peripheral is not a modem!')
  10. end
  11. if not args[1] then
  12.     error('Please specify a file!')
  13. else
  14.     local file = fs.open(args[1])
  15.     rednet.open(args[2])
  16.     rednet.send(19,file.readAll(),'print')
  17.     rednet.close(args[2])
  18.     file.close()
  19. end
Advertisement
Add Comment
Please, Sign In to add comment