Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem", rednet.open)
- function getModem()
- return modem
- end
- function send(id, protocol, table)
- local data = textutils.serialize(table)
- rednet.send(id, data, protocol)
- end
- function receive()
- local id, data, protocol = rednet.receive()
- local table = textutils.unserialize(data)
- return id, protocol, table
- end
- function request(id, protocol, table)
- send(id, protocol, table)
- return receive()
- end
- return {
- getModem = getModem,
- send = send,
- receive = receive,
- request = request
- }
Advertisement
Add Comment
Please, Sign In to add comment