From e04e1857a07f0f059e331daeb9071c2743145a74 Mon Sep 17 00:00:00 2001 From: Olav Bakke Svendsen Date: Wed, 18 Oct 2023 04:03:46 +0200 Subject: [PATCH] Adding startup script to delay program execution until everything is properly loaded after a crash ..hopefully --- common/delayed_startup.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 common/delayed_startup.lua diff --git a/common/delayed_startup.lua b/common/delayed_startup.lua new file mode 100644 index 0000000..4bacbbb --- /dev/null +++ b/common/delayed_startup.lua @@ -0,0 +1,28 @@ +-- delayed_startup.lua +-- save as "/startup.lua" and modify delay and run + +-- delay in seconds +local delay = 60 + +-- what to do after delay +local run = function() + +end + + + +local wait = os.startTimer(60) +term.clear() +term.setCursorPos(1,1) +print("Starting in "..tostring(delay).." seconds") +print("Press any key to cancel...") +while true do + local e, t = os.pullEvent() + if e == "timer" and t == wait then + run() + elseif e == "char" then + print("Canceled") + os.cancelTimer(wait) + break + end +end -- 2.30.2