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

Wimpy Question But I'm New

Started by sekots, 25 July 2013 - 06:56 PM
sekots #1
Posted 25 July 2013 - 08:56 PM
turtle.up(3) doesn't go up 3 times. It has no error, and it goes up 1 time. What am I supposed to put inside of the (). I've looked on the wiki but I can't find the list of codes for turtles.
Lyqyd #2
Posted 26 July 2013 - 12:14 AM
Split into new topic.

Movement functions don't take arguments:


turtle.up()
turtle.up()
turtle.up()

or:


for i = 1, 3 do
  turtle.up()
end
Lord_Spelunky #3
Posted 26 July 2013 - 05:14 AM
You could make a function that does it though, a bit like this

function up(amount)
  for i = 1, amount do
    turtle.up()
  end
end
HurricaneCoder #4
Posted 27 July 2013 - 05:57 AM
you don't have to put anything in the (). when ever there is () doesn't mean you have to enter something.
Qix #5
Posted 30 July 2013 - 06:29 AM
Another alternative:


turtle._up = turtle.up
turtle.up = function(amt)
   for i=1,amt do
	  turtle._up()
   end
end

That will override the original turtle API function and provide a function similar to what Lord_Spelunky suggested. To me, it's cleaner when calling the function.