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

Unexpected symbol problem

Started by CastleMan2000, 21 April 2014 - 06:18 PM
CastleMan2000 #1
Posted 21 April 2014 - 08:18 PM
bios:366: [string "agps"]:17: unexpected symbol

I get this error when I try to run my program. It's designed to be a simple GPS locator. Along with this problem, I worry about the scope of my variables (i.e. if another part of the program won't be able to access a variable it needs), so any help with other general debugging in the program would be appreciated.

Pastebin link: http://pastebin.com/7dfJSWME
Lyqyd #2
Posted 21 April 2014 - 08:23 PM
When setting table values (in this case, newHome[1] through 3), you don't use the local keyword. You only use the local keyword when declaring the table itself, if desired.
Dayrider10 #3
Posted 21 April 2014 - 08:25 PM
You localized the table newHome in the first function. Since that is the case the table returns nil. I would suggest using table.insert in this case.
CastleMan2000 #4
Posted 21 April 2014 - 08:38 PM
Ah. Okay. I'll try that.

Alright, new problem. Line 49, attempted to get length of nil. I suspect this is due to the localization of homeLoc on line 30. How do I fix this? Am I wrong in the assumption (I think actually maybe from past experience) that non-local vars will "leak" into other programs (i.e. if you create variable "foo" in prog1, and prog2 calls the value of "foo", then prog2 gets the value of foo that was established in prog1, and vice versa for others)?

EDIT: Fixed it, nevermind.
Edited on 21 April 2014 - 07:04 PM