Advertisement
HandieAndy

receive_dig.lua

May 11th, 2019
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.52 KB | None | 0 0
  1. local component = require("component")
  2. local event = require("event")
  3. local shell = require("shell")
  4. local modem = component.modem
  5.  
  6. local PORT = 10001
  7.  
  8. modem.open(PORT)
  9.  
  10. function receive()
  11.     print("Waiting for command on port " .. PORT)
  12.     local _, _, sender, port, distance, msg = event.pull("modem_message")
  13.     local length = tonumber(msg)
  14.     print("Got request to execute length of " .. length .. " from " .. sender)
  15.     shell.execute("fillLine minecraft:dirt 0 " .. length)
  16.     print("Done!")
  17. end
  18.  
  19. while true do
  20.     receive()
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement