anfbckdo

load.lua

Dec 21st, 2023
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. -- This program runs on the computer and grabs the network.lua file that holds network capabilities.
  2.  
  3. if fs.exists("/network.lua") then -- checks if /network.lua is a valid directory
  4.     printError("file 'network.lua' already exists") -- error if the file already exists in the root directory
  5. else    -- if not, it looks for a disk
  6.     if fs.exists("/disk") then
  7.         print("found disk") -- if it finds a disk, it prints it and checks for the directory "/disk/network.lua" (line 10)
  8.         sleep(1)
  9.  
  10.         if fs.exists("/disk/network.lua") then
  11.             -- lines 12-15 are copying and moving the file "network.lua" to the main filesystem of the computer.
  12.             print("found network file")
  13.             fs.copy("/disk/network.lua", "/network.lua")
  14.             print("Copied network file!")
  15.             print("network file is in root directory.")
  16.         else -- if network.lua doesn't exist inside the disk, it prints an error.
  17.             printError("could not find network.lua, check the file is in the disk directory.") -- error handling
  18.         end
  19.     else
  20.         printError("could not find '/disk' directory. Is there a valid floppy disk?") -- error handling
  21.     end
  22. end
  23.  
Advertisement
Add Comment
Please, Sign In to add comment