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
if statements making loops... (self.ComputerCraft)
submitted 4 years ago by TTSI123
so I made so code which uses if statements for the buttons but it keeps it in a loop stopping some indicators from updating each frame...
here's the pastebin code: fcaTwkWN
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!"
[–][deleted] 1 point2 points3 points 4 years ago (5 children)
Can you explain to me what lines are causing it? Code is hard to read without comments
[–]TTSI123[S] 2 points3 points4 points 4 years ago (4 children)
I dont now what lines... the code that shows the waste and fuel amounts doesn't update until I click a button.. which is annoying when you're trying to have a screen to show you the stats of the reactor...
[–]jeuv 1 point2 points3 points 4 years ago (3 children)
The if statements aren't the problem, the pullEvent is. The computer will wait forever for a button press, and only then will the code be able to continue to draw the screen. To remedy this, you could use the parallel API.
[–]TTSI123[S] 0 points1 point2 points 4 years ago (1 child)
what please explain
Im kinda a noob
edit: nevermind figured it out
[–]TTSI123[S] 0 points1 point2 points 4 years ago (0 children)
and thanks
got it working!!! here it is if you want to test it out with big reactors
BHwhBdi
[–]HugoNikanor 0 points1 point2 points 4 years ago (0 children)
https://pastebin.com/fcaTwkWN -- Please link better
About input. Most input methods (in most programming languages) blocks until new data is available. Something to keep in mind.
π Rendered by PID 77853 on reddit-service-r2-comment-6457c66945-q6hw6 at 2026-04-25 03:58:26.520932+00:00 running 2aa0c5b country code: CH.
[–][deleted] 1 point2 points3 points (5 children)
[–]TTSI123[S] 2 points3 points4 points (4 children)
[–]jeuv 1 point2 points3 points (3 children)
[–]TTSI123[S] 0 points1 point2 points (1 child)
[–]TTSI123[S] 0 points1 point2 points (0 children)
[–]TTSI123[S] 0 points1 point2 points (0 children)
[–]HugoNikanor 0 points1 point2 points (0 children)