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

How do I add a variable to the program execute?

Started by Gyronimo, 19 January 2013 - 08:14 AM
Gyronimo #1
Posted 19 January 2013 - 09:14 AM
I'm wondering how I could add a variable for when I execute my program.

For instance, you can execute "excavate 10", and it will excavate a 10x10 area.

Thanks for your help! :)/>
Lyqyd #2
Posted 19 January 2013 - 09:23 AM
You catch the arguments passed in from the shell.


local args = {...} --put the arguments from the shell in a table
print(#args) --print the number of arguments that were passed in
print(args[1]) --print the first argument that was passed in