Question:How can i input 2 things on 1 line like the tunnel program does "tunnel 10", it just seems more efficient
0
Taking command-line arguments?
Started by B EZ MAN, Mar 10 2013 12:28 PM
3 replies to this topic
#1
Posted 10 March 2013 - 12:28 PM
#2
Posted 10 March 2013 - 03:18 PM
Split into new topic. A title was provided for you.
#3
Posted 10 March 2013 - 03:20 PM
What you're looking for is "args = {...}". for example, if you start your program as "DigDown 15"...
args = {...}
intDigDistance = args[1]
for i,intDigDistance do
turtle.digDown()
turtle.down()
end
That will send the turtle down 15 blocks. or if you instead type "DigDown 30", it'll go down 30.
args = {...}
intDigDistance = args[1]
for i,intDigDistance do
turtle.digDown()
turtle.down()
end
That will send the turtle down 15 blocks. or if you instead type "DigDown 30", it'll go down 30.
#4
Posted 11 March 2013 - 03:10 AM
It is the same as if you use shell.run(function, arg1, arg2, arg3, ..., argn)
All these arguments are stored in the ... and you can pack them into a table.
The CC startup screen should use the same function. So the first string you type in is your file and anything followed by this that is separated with a space will be passed over as an argument
All these arguments are stored in the ... and you can pack them into a table.
The CC startup screen should use the same function. So the first string you type in is your file and anything followed by this that is separated with a space will be passed over as an argument
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users