Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- os.loadAPI("ocs/apis/sensor")
- local a = peripheral.wrap("right")
- local s = sensor.wrap("left")
- local chest = s.getTargetDetails("0,1,0")
- local done = false
- local addedItems = {}
- local function copyFile(fileR, fileW)
- readFile = fs.open(fileR,"r")
- writeFile = fs.open(fileW,"w")
- while true do
- local lineRead = readFile.readLine()
- if lineRead == nil then
- break
- end
- local lineWritten = writeFile.writeLine(lineRead)
- end
- readFile.close()
- writeFile.close()
- end
- local function deleteLine(fileR, fileW, item)
- readFile = fs.open(fileR,"r")
- writeFile = fs.open(fileW,"w")
- while true do
- local lineRead = readFile.readLine()
- if lineRead == nil then
- break
- end
- if not string.match(lineRead, item) then
- local lineWritten = writeFile.writeLine(lineRead)
- else
- print(item.." was removed from list.")
- end
- end
- readFile.close()
- writeFile.close()
- end
- copyFile("ID.txt", "ID")
- print("Item to delete: ")
- local itemToDelete = read()
- deleteLine("ID","ID.txt", itemToDelete)
- fs.delete("ID")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement