Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local filename = shell.getRunningProgram() -- Get the name of this Lua script file
- local fileToMonitor = filename -- Set the file to monitor as this Lua script file
- local interval = 5 -- Interval in seconds
- while true do
- if fs.exists(fileToMonitor) then
- -- Your code to send a message or perform actions when the file is found
- -- For example: redstone.setOutput("back", true)
- print("File found!")
- else
- -- Your code to run when the file is not found
- -- For example: shell.run("program_to_execute")
- print("File not found!")
- end
- os.startTimer(interval)
- os.pullEvent("timer")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement