Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function connect()
- rednet.open("top")
- rednet.open("back")
- rednet.open("right")
- rednet.open("left")
- end
- function disconnect()
- rednet.close("top")
- rednet.close("back")
- rednet.close("right")
- rednet.close("left")
- end
- function receiveFile(path,inputid)
- local file = fs.open(path,"w")
- id, msg = rednet.receive()
- if id == inputid then
- file.write((msg))
- file.close()
- end
- end
- function sendFile(path,inputid)
- local file = fs.open(path,"r")
- content = file.readAll()
- rednet.open("top")
- rednet.send(inputid,(content))
- file.close()
- end
- tArgs = {...}
- if tArgs[1] == "send" then connect() sendFile(tArgs[2],tArgs[3]) disconnect()
- elseif tArgs[1] == "receive" then connect() receiveFile(tArgs[2],tArgs[3]) disconnect()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement