Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function printSeperator()
- print("---------------------------------------")
- end
- local id = ...
- local senderId,message,protocol = rednet.receive("DATA", 10)
- if protocol == nil then
- print("Attempt to receive data timed out")
- printSeperator()
- dofile("awaitRequest.lua")
- elseif protocol == "DATA" then
- print("Successfully received data, creating file...")
- end
- if not fs.exists("db/" .. senderId) then
- print("No directory matching device ID (#" .. senderId .. ") found in database")
- printSeperator()
- dofile("awaitRequest.lua")
- end
- if tostring(id) == tostring(senderId) then
- if not fs.exists("db/" .. senderId .. "/" .. message .. ".lua") then
- print("No file matching name (#" .. message .. "lua" .. ") found in database")
- printSeperator()
- dofile("awaitRequest.lua")
- end
- shell.run("delete", "db/" .. senderId .. "/" .. message .. ".lua")
- print("Succesfully removed file '" .. message .. ".lua' from database")
- rednet.send(tonumber(id),"","SUCCESS")
- printSeperator()
- dofile("awaitRequest.lua")
- else
- print("Error while establishing uplink, incorrect device ID, #" .. senderId .. " (Expected #" .. id .. ")")
- printSeperator()
- dofile("awaitRequest.lua")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement