Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Computronics Tape Writer
- -- Made by YuRaNnNzZZ
- local arg = { ... }
- local tape = peripheral.wrap("left")
- function twiddle_thumbs()
- os.queueEvent("randomEvent")
- os.pullEvent()
- end
- if #arg < 1 then return end
- if not fs.exists(arg[1]) then print("File not found!") return end
- local size = tape.getSize()
- tape.seek(0 - size)
- local file_in = tostring(arg[1])
- local bytes = fs.getSize(file_in)
- if bytes > size then print("Not enough space on tape.") return end
- tape.setLabel(arg[1])
- local file = fs.open(file_in, "rb")
- write("Wrote ")
- local curx,cury = term.getCursorPos()
- for i=1,bytes do
- twiddle_thumbs()
- term.setCursorPos(curx,cury)
- write(i .. "/" .. bytes .. " bytes to tape")
- tape.write(file.read(i))
- end
- print(".")
- file.close()
- print("Tape wrote successfully.")
- tape.seek(0 - size)
- file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement