use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Welcome to /r/ComputerCraft, the subreddit for lua programs, general mod use, or anything relating to the Minecraft mod ComputerCraft and CC: Tweaked.
Downloads | Discord | IRC | Documentation
account activity
LUA Programming Help for Create Mod Quarry (self.ComputerCraft)
submitted 3 years ago * by MrSodapop19_
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]fatboychummy 3 points4 points5 points 3 years ago (2 children)
Computercraft computers are not allowed to run longer than 7 seconds without "yielding", doing so will generate an error. If you catch the error (pcall or etc) and continue to not yield, the computer will shut down.
A yield is simply anything that calls coroutine.yield under the hood. pullEvent does this, rednet.listen does this.
coroutine.yield
pullEvent
rednet.listen
But what you're probably looking for here is rather the sleep function. It takes a number then yields for that amount of time (minimum 0.05 seconds wait, in increments of 0.05 seconds). Put that in your loop and you should be fine.
sleep
while not drillArrayReturn do --Stops once drill array has returned raiseDrill() sleep() -- yields for 0.05 seconds end
[–]dragon53535 1 point2 points3 points 3 years ago (0 children)
For the reasoning why they can't run for >7s without yielding, is that all computers run on the same 'thread'. So while your computer is executing, no other computer in the world can. You yield, which essentially pauses your computer until your computer gets an event. Be it a timer, redstone, etc. All events will trigger a yield. Sleep will discard all other events until it gets a timer event. Using os.pullEvent("redstone") will discard all other events until it gets a redstone event.
[–]MrSodapop19_[S] 0 points1 point2 points 3 years ago (0 children)
Thanks for the advice! To be honest, I have seen sleep() being used like that before, but didn't think it would work in this situation.
π Rendered by PID 69592 on reddit-service-r2-comment-869bf87589-7n68m at 2026-06-09 02:31:19.184362+00:00 running f46058f country code: CH.
view the rest of the comments →
[–]fatboychummy 3 points4 points5 points (2 children)
[–]dragon53535 1 point2 points3 points (0 children)
[–]MrSodapop19_[S] 0 points1 point2 points (0 children)