Jump to content




:7: ')' expected


  • You cannot reply to this topic
3 replies to this topic

#1 Sucon

  • New Members
  • 2 posts

Posted 31 August 2016 - 07: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!

#2 TheRockettek

  • Members
  • 547 posts
  • LocationRem is best girl

Posted 31 August 2016 - 09: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"

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 31 August 2016 - 09: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")


#4 Sucon

  • New Members
  • 2 posts

Posted 31 August 2016 - 11:24 PM

Silly me.

Works perfectly.

Thank you both very much!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users