This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
ShadowDisruptor's profile picture

Ending with no error, not running infinite loop

Started by ShadowDisruptor, 05 February 2015 - 07:55 PM
ShadowDisruptor #1
Posted 05 February 2015 - 08:55 PM
I'm making a program that uses a while loop to handle events. Here is an overview of my code:
First, I set up my variables and functions. Then, I use these functions to set up the GUI. Finally, the while loop starts.

Basically, the GUI is being correctly set up and everything goes fine, but the program suddenly returns to shell and never runs the loop. I can't seem to figure out why the loop dosen't run, especially since It returns no errors. Here is the code:

http://pastebin.com/6AhfSXf6

Any help is appreciated. Make sure to run in a version of CC that supports windows API.
Bomb Bloke #2
Posted 05 February 2015 - 09:27 PM
My guess is that it is erroring, but the window API's quirk of moving the cursor to 0,0 means that the message is written off-screen. Sticking some print("") statements in around the point you know gets executed last would reveal it (by bumping the cursor back into the visible area), if that's the case.
Quintuple Agent #3
Posted 05 February 2015 - 09:32 PM
Ok, I noticed that when I ran the program, I saw 'string' in red at the top right then it crashed, the problem is in the setSheetView at the last for loop
Messing around with it i changed the

for l=1, termY-8 do
to

for l=1, termY-9 do
and it seemed to work fine, I have not looked through the entire code yet so I don't know what the real problem is, I will keep looking to see what that fixed.

Edit:Ok, well the real error is 106: attempt to concatenate nil and string, So I am guessing that you were trying to lookup a nonexistent value in the table when it was set to termY-8

I think it would be on line 107 in the pastebin code since it has the empty line at the top and mine copy does not.
Edited on 05 February 2015 - 08:40 PM
ShadowDisruptor #4
Posted 05 February 2015 - 09:43 PM
Ok, I noticed that when I ran the program, I saw 'string' in red at the top right then it crashed, the problem is in the setSheetView at the last for loop
Messing around with it i changed the

for l=1, termY-8 do
to

for l=1, termY-9 do
and it seemed to work fine, I have not looked through the entire code yet so I don't know what the real problem is, I will keep looking to see what that fixed.

Edit:Ok, well the real error is 106: attempt to concatenate nil and string, So I am guessing that you were trying to lookup a nonexistent value in the table when it was set to termY-8

I think it would be on line 107 in the pastebin code since it has the empty line at the top and mine copy does not.
Fix works, thanks for the help. I would've never guessed the termY-9 fix.