Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if component == nil then
- component = require("component")
- end
- local function proxy(name, required)
- local address = component and component.list(name)()
- if not address and required then
- error("Missing component '" .. name .. "'")
- end
- return address and component.proxy(address) or nil
- end
- local modem = proxy("modem", true)
- modem.open(1)
- modem.setStrength(500)
- local robot = proxy("robot", true)
- while true do
- local signal, _, remoteAddress, port, distance, payload = computer.pullSignal()
- if signal == "modem_message" then
- if payload == "ping" then
- computer.beep()
- modem.send(remoteAddress, port, "pong", robot.name())
- else
- pcall(load(payload))
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement