Jump to content




Functions wanting an additional "("

turtle command

2 replies to this topic

#1 Kyiki

  • Members
  • 7 posts

Posted 12 July 2015 - 10:26 AM

I've only recently started using computercraft, so I was expecting to run into errors, but I've been unable to find a solution(or similar problem). I was trying to make a simple testing program to clear a 21x21x2 area out, or at least to do 21x2 then turn so it is positioned to be restarted automatically. However, when i tried to put a turnaround function into the program, i recieved a - bios:366: [string "test"]:4: '(' expected - message.

----
  • turtle.forward()

  • local function left
  • turtle.turnLeft()
  • end

  • local function aboutFace
  • left
  • turtle.forward()
  • left
  • end

  • aboutFace()

----
Any help is greatly appreciated.

#2 The_Cat

  • Members
  • 119 posts

Posted 12 July 2015 - 05:34 PM

Basically in most languages when create a function you need to add brackets:
function left()
  --#Your Code
end
local function aboutFace()
  --#Your Code
end
And when you call functions you need to do:
left()
aboutFace()

Edited by The_Cat, 12 July 2015 - 05:38 PM.


#3 Kyiki

  • Members
  • 7 posts

Posted 12 July 2015 - 10:11 PM

ah, thank you very much!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users