Advertisement
DOGGYWOOF

error handler

Jan 5th, 2024 (edited)
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. -- List of required files
  2. local requiredFiles = {
  3. "file1.txt",
  4. "file2.txt",
  5. "file3.txt"
  6. -- Add more file names as needed
  7. }
  8.  
  9. -- Function to check if all required files exist
  10. local function checkFiles()
  11. local missingFiles = {}
  12.  
  13. for _, fileName in ipairs(requiredFiles) do
  14. if not fs.exists(fileName) then
  15. table.insert(missingFiles, fileName)
  16. end
  17. end
  18.  
  19. return missingFiles
  20. end
  21.  
  22. -- Main function to execute no-os.lua if files are missing
  23. local function main()
  24. local missing = checkFiles()
  25.  
  26. if #missing > 0 then
  27. -- Execute no-os.lua if any files are missing
  28. shell.run("no-os.lua")
  29. else
  30. -- All files exist, continue with your code here
  31. print("All required files found. Continuing...")
  32. -- Add your code to run if all files exist
  33. end
  34. end
  35.  
  36. -- Run the main function
  37. main()
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement