Neon1432

quarryui

Nov 7th, 2025 (edited)
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. local PARAMPATH = "files/quarry"
  2.  
  3. ---Loads a locally saved table and returns it
  4. ---@param path string a valid filepath
  5. ---@return table params or empty table
  6. local function loadParams(path)
  7.     local file = fs.open(path, "r")
  8.     if file ~= nil then
  9.         local data = file.readAll()
  10.         file.close()
  11.         return textutils.unserialize(data)
  12.     else
  13.         return {}
  14.     end
  15. end
  16.  
  17. ---Saves the table at the defined path
  18. ---@param path string a valid filepath
  19. ---@param table table paramtable to save
  20. local function saveParams(path, table)
  21.     local file = fs.open(path, "w")
  22.     file.write(textutils.serialize(table))
  23.     file.close()
  24. end
  25.  
  26. local id = shell.openTab("con")
  27. multishell.setTitle(id, "controller")
  28.  
  29. while true do
  30.     local text = read()
  31.     local params = loadParams(PARAMPATH)
  32.     if text == "skip" then
  33.         params.skip = true
  34.         saveParams(PARAMPATH, params)
  35.         print("skipping current...")
  36.         sleep(2)
  37.     elseif text == "skiprow" then
  38.         params.skiprow = true
  39.         saveParams(PARAMPATH, params)
  40.         print("skipping current row...")
  41.         sleep(2)
  42.     elseif text == "stop" then
  43.         params.stop = true
  44.         saveParams(PARAMPATH, params)
  45.         print("stopping progress on next level...")
  46.         sleep(2)
  47.     elseif text == "start" then
  48.         params.stop = false
  49.         saveParams(PARAMPATH, params)
  50.         print("restarting...")
  51.         sleep(2)
  52.     end
  53.     term.clear()
  54.     term.setCursorPos(1, 1)
  55. end
  56.  
Advertisement
Add Comment
Please, Sign In to add comment