From: Olav Bakke Svendsen Date: Wed, 18 Oct 2023 02:03:46 +0000 (+0200) Subject: Adding startup script to delay program execution until everything is properly loaded... X-Git-Tag: stable-steam~1 X-Git-Url: http://git.olavbs.no/?a=commitdiff_plain;h=e04e1857a07f0f059e331daeb9071c2743145a74;p=cc.git Adding startup script to delay program execution until everything is properly loaded after a crash ..hopefully --- 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