Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sendFile(filename, ID) -- Opens a file and sends it as a single string
- if fs.exists(filename) then
- local fp = io.open( filename, "r" )
- local content = ""
- for line in fp:lines() do
- content = content..line.."n"
- end
- fp:close()
- rednet.send(ID, content)
- else
- error("Need to define a file name which exists")
- end
- end
- function writeFile(String, filename) -- Receives a string and writes it into a file. Best with sendFile.
- local fp = io.open( filename, "w" )
- fp:write(String)
- fp:close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement