From c713e0118d283d6a9cf713337d91e9a358750a8d Mon Sep 17 00:00:00 2001 From: hkc Date: Wed, 18 Oct 2023 01:11:38 +0300 Subject: [PATCH] -S now means "seek to" --- tapeget.lua | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/tapeget.lua b/tapeget.lua index 5e8b79d..cb89976 100644 --- a/tapeget.lua +++ b/tapeget.lua @@ -1,10 +1,10 @@ local args = { ... } -local shouldSeek = true +local seekTo = 0 local driveName = nil if args[1] == "-S" then - shouldSeek = false table.remove(args, 1) + seekTo = tonumber(table.remove(args, 1)) end if args[1] == "-D" then table.remove(args, 1) @@ -93,10 +93,9 @@ if length > tape.getSize() then end tape.stop() -if shouldSeek then - tape.seek(-tape.getSize()) - tape.stop() -end +tape.seek(-tape.getSize()) +tape.seek(seekTo) +tape.stop() local _, y = term.getCursorPos() local written = 0 @@ -121,7 +120,5 @@ term.clearLine() print("Written "..n_to_kib(written)) tape.stop() -if shouldSeek then - tape.seek(-tape.getSize()) - tape.stop() -end +tape.seek(-tape.getSize()) +tape.stop()