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

What is it called? (Need Help)

Started by gheotic, 17 January 2013 - 07:09 AM
gheotic #1
Posted 17 January 2013 - 08:09 AM
I have been wondering about the default programs like turtle excavate program that you just have to write
excavate (then the area thing)

how is it possible to just make it write it program and then a variable ??

any help would be appreciated :)/>
remiX #2
Posted 17 January 2013 - 08:16 AM
This is known as arguments


args = {...} -- the ... is for the arguments and the {} stores them into a table

-- To access the variables to use it like a normal everyday table

length = tonumber(args[1]) -- takes the first one and then converts it to a number
-- etc
Lyqyd #3
Posted 17 January 2013 - 08:18 AM
If you are interested in knowing how they work, the better search term is variadic arguments.
gheotic #4
Posted 17 January 2013 - 10:11 AM
Thank you soo much! :)/>