From 9e44c53e42912deb268a9541124b22d436d87538 Mon Sep 17 00:00:00 2001 From: hkc Date: Wed, 18 Oct 2023 00:44:24 +0300 Subject: [PATCH] Added drive selector --- tapeget.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tapeget.lua b/tapeget.lua index 1ba739b..d8193fb 100644 --- a/tapeget.lua +++ b/tapeget.lua @@ -31,10 +31,24 @@ local function textProgress(p, c1, c2, fmt, ...) term.setBackgroundColor(bg) end -local tape = peripheral.find("tape_drive") -if not tape then +local tape = { peripheral.find("tape_drive") } +if #tape == 0 then print("tape where") return +elseif #tape ~= 1 then + print("More than one drive found:") + for i = 1, #tape do + print(tape[i]) + end + print("Input drive name:") + io.write("> ") + tape = peripheral.wrap(read()) + if not tape then + printError("wrong name") + return + end +else + tape = tape[1] end if not http then