computercraft/send_file
2021-01-09 03:55:07 +01:00

29 lines
509 B
Plaintext

dofile("utils")
modemSide = utils.getSideOf("modem")
rednet.open(modemSide)
term.write("Path: ")
path = tostring(read())
local file = fs.open(path, "r")
content = file.readAll()
data = textutils.serialize(content)
term.write("Receiver id: ")
id = tonumber(read())
print("Initialize receiver please!")
print("Press 's' to send")
local event, c = os.pullEvent("char")
if c == "s" then
print("Sending...")
print(id)
rednet.send(id, data)
else
print("Aborted.")
end
rednet.close(modemSide)