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

Error '(' expected. Need help!

Started by Ddonnell, 01 June 2015 - 06:50 AM
Ddonnell #1
Posted 01 June 2015 - 08:50 AM
Hey, thank you for checking out this post! I'm a total newb when it comes to computercraft and even more when it comes to Lua. I've only since yesterday started to learn the programming and language and keep getting stuck! I have written one showing the error and pastebin link to code. I can't figure this error out and hoping someone will tell me!

Also if this isn't the place to post my error please direct me to the correct place :)/>


> room
bios:367: [string "room"] :2:  '('
expected

http://pastebin.com/kfU01M53

Thank you!
Lupus590 #2
Posted 01 June 2015 - 12:59 PM
when declaring a function you need to add brackets after the function name

--#example function
function example() --#you are missing the ()'s
  --#code goes here
end
Ddonnell #3
Posted 01 June 2015 - 02:10 PM
Thank you! I managed to figure it out in the end, but it's much better with clarification so I understood the error.
Thanks again!
com_kieffer #4
Posted 01 June 2015 - 02:32 PM
You're also missing parens after your function invocations. Here is the corrected code:

function oneThird()
   turtle.dig()
   turtle.turnRight()
   turtle.forward()
   turtle.turnLeft()
   turtle.dig()
   turtle.turnRight()
   turtle.forward()
   turtle.turnLeft()
   turtle.dig()
end
function Second()
   turtle.up()
end
oneThird()
Second()