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

User friendly input variables

Started by tysciman7, 28 January 2013 - 12:28 PM
tysciman7 #1
Posted 28 January 2013 - 01:28 PM
I want to have something do something for a crtain amount of times that i tell it to do
for example i want to make a new turtle program to make it move a number of times i tell it to go and i dont want to have to edit the program everytime so one time ill say do something 3 times and at another time i tell it to do that same thing 5 times
NeverCast #2
Posted 28 January 2013 - 01:32 PM

local args = { ... }
local times = tonumber(args[1])
for i = 1, times do
  turtle.forward()
end

Save it as cool

Type cool 10
in to the computer.