local PARAMPATH = "files/quarry"
---Loads a locally saved table and returns it
---@param path string a valid filepath
---@return table params or empty table
local function loadParams(path)
local file = fs.open(path, "r")
if file ~= nil then
local data = file.readAll()
file.close()
return textutils.unserialize(data)
else
return {}
end
end
---Saves the table at the defined path
---@param path string a valid filepath
---@param table table paramtable to save
local function saveParams(path, table)
local file = fs.open(path, "w")
file.write(textutils.serialize(table))
file.close()
end
local params = loadParams(PARAMPATH)
while true do
local text = read()
if text == "skip" then
params.skip = true
saveParams(PARAMPATH, params)
print("skipping current...")
sleep(2)
elseif text == "skiprow" then
params.skiprow = true
saveParams(PARAMPATH, params)
print("skipping current row...")
sleep(2)
end
term.clear()
term.setCursorPos(1, 1)
end