Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.find "modem"
- local channel = 15215
- m.open(channel)
- m.transmit(channel, channel, {"swap"})
- parallel.waitForAny(function()
- while true do
- local _, _, c, rc, msg = os.pullEvent "modem_message"
- if type(msg) == "table" and c == channel and msg[1] == "swapped" then
- if msg[2] then
- print "Success!"
- return
- else
- printError("Swap failed (reason: " .. msg[3] .. ").")
- return
- end
- end
- end
- end, function()
- sleep(3)
- printError "Timed out."
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement