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

:7: ')' expected

Started by Sucon, 31 August 2016 - 06:56 AM
Sucon #1
Posted 31 August 2016 - 08:56 AM
Hi,

I'm currently getting the error, ":7: ')' expected"


Normally with this error I would do the obvious, find the missing closed parenthesis. From my multiple revisions I cannot find a missing one.

I'm looking to write a program that basically sends and receives from a turtle that will tell that turtle to run a selection of predefined functions within the turtle that will build and cleanup things.

I'm aware this is likely poorly written code for what I'm trying to do, but it's more for my own learning.

I'm relatively new to ComputerCraft/Lua and am sure I'm missing something relatively obvious so please bear with me as I bumble my way through the syntax.

http://pastebin.com/CRD2kgS0

Thanks in advance!
TheRockettek #2
Posted 31 August 2016 - 10:31 AM
When putting " in a string bear in mind lua thinks thats the end of it. So to freely use " in a string put a \ before it :)/>

Print("Im "Happy"") -> ) expected

Print("Im \"Happy\"") -> Im "Happy"
Bomb Bloke #3
Posted 31 August 2016 - 10:33 AM
Line seven reads:

print("Type "continue" in order to begin cleanup")

You've got the word "continue" sitting where the interpreter is expecting the bracket.

One way around this is to use mis-matching quote symbols, eg:

print('Type "continue" in order to begin cleanup')

Another is to use escape characters to indicate that you intend certain quotes to be part of the one string:

print("Type \"continue\" in order to begin cleanup")
Sucon #4
Posted 01 September 2016 - 12:24 AM
Silly me.

Works perfectly.

Thank you both very much!