Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- idsToCheck = {}
- -- list of ids to check and update from
- tArgs = { ... }
- local newFileContents = ""
- local overwrite = false
- if tArgs[1] then
- if fs.exists(tArgs[1]) then
- print("File exists. Overwrite? (Y/N)")
- answer = read()
- if answer:lower() == "y" then
- overwrite = true
- end
- end
- if not fs.exists(tArgs[1]) or overwrite then
- for i=1,#idsToCheck do
- rednet.send(idsToCheck[i],"sendScan")
- local currID = -1
- while currID ~= idsToCheck[i] do
- currID,msg = rednet.receive(0.1)
- if not currID then break end
- end
- if currID then
- spacing = "\n\n\n"
- if newFileContents == "" then spacing = "" end
- newFileContents = newFileContents .. spacing .. "Log for ID: " .. currID .. "\n" .. msg
- end
- end
- logFile = fs.open(tArgs[1],"w")
- logFile.write(newFileContents)
- logFile.close()
- end
- else
- print("Invalid arguments. Give file output as first argument.")
- end
Advertisement
Add Comment
Please, Sign In to add comment