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

Program Throwing Up Odd Error

Started by LuaNoobster, 20 July 2014 - 05:19 PM
LuaNoobster #1
Posted 20 July 2014 - 07:19 PM
Here is the code I am suing for the program:
http://pastebin.com/Rvtn6Bjw

and the error I get is this:


bios:366: [string "Radio"]:7: '}' expected (to close '{' at line 3)

At first glance I thought I had forgotten a closing bracket or misplaced one, but the table started on line 3 is properly closed on line 10, so why is it saying I need a closing bracket on line 7?
Bomb Bloke #2
Posted 20 July 2014 - 08:14 PM
'cause you didn't stick a ; on line 6. It guesses you meant to put a } around that position instead.
Arektor #3
Posted 20 July 2014 - 08:17 PM

local button = {
  buton_defaults = {
	__index = {
	  color_bg = colors.gray;
	  color_cl = colors.red;
	  color_txt = colors.black
	  height = 3;
	  padding = 2;
	  isClicked = false;
	};
  };

Stop me If I am wrong but…

	  isClicked = false;
	};
  };

Shouldn't it be

	  isClicked = false;
	}
  }
? (And for all the others "}")
Edited on 20 July 2014 - 06:18 PM
theoriginalbit #4
Posted 21 July 2014 - 01:45 AM
-telling to remove semicolons-
semi-colons are allowed as separators in tables and removing them would cause an error. As Bomb Bloke stated the problem is after color_txt = colours.black
Bomb Bloke #5
Posted 21 July 2014 - 05:09 AM
Removing those particular ones wouldn't error, but it's not a problem to leave them in there, either.
theoriginalbit #6
Posted 21 July 2014 - 05:21 AM
actually removing one of the two that Arektor suggested removing would cause an error. You could safely remove the one on line 10, but removing the one on line 11 would cause a problem due to the table declaration not being complete.
Bomb Bloke #7
Posted 21 July 2014 - 05:38 AM
True.
LuaNoobster #8
Posted 22 July 2014 - 03:45 AM
I got my program working, thanks to Bomb for pointing out my obvious oversight, that wasn't the only missing semicolon either. Lesson learned about coding at 4am. And @Arketor, as was said, some of those semicolons being removed would cause errors, the others are there for personal OCD reasons. There are some other errors in this code, but I fixed it.