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
- fs.makeDir("db/" .. senderId)
- end
- if tostring(id) == tostring(senderId) then
- local file = fs.open("db/" .. senderId .. "/" .. message[1] .. ".lua", "w")
- file.write(message[2])
- file.close()
- print("Succesfully created file '" .. message[1] .. ".lua' in 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