Difference between revisions of "Shell.run"
From ComputerCraft Wiki
Bomb Bloke (Talk | contribs) (Notes re parameters.) |
Bomb Bloke (Talk | contribs) m |
||
Line 8: | Line 8: | ||
|desc=Runs ''program'' with as many specified arguments as are provided.<br><br> | |desc=Runs ''program'' with as many specified arguments as are provided.<br><br> | ||
− | Essentially takes all parameters passed to it and runs them as one line - for eg, shell.run("monitor","top","alongtimeago") is the same as shell.run("monitor top alongtimeago"), | + | Essentially takes all parameters passed to it and runs them as one line - for eg, shell.run("monitor","top","alongtimeago") is the same as shell.run("monitor top alongtimeago"), and you can use whichever syntax happens to suit you.<br><br> |
See also: [[shell.openTab|shell.openTab()]] | See also: [[shell.openTab|shell.openTab()]] | ||
Line 18: | Line 18: | ||
}} | }} | ||
{{Example | {{Example | ||
− | |desc=Runs the program " | + | |desc=Runs the program "monitor" along with the other arguments set in "myTable": |
|code= local myTable = {"monitor","left","worm"} | |code= local myTable = {"monitor","left","worm"} | ||
Latest revision as of 07:30, 4 April 2014
Function shell.run | |
Runs program with as many specified arguments as are provided. Essentially takes all parameters passed to it and runs them as one line - for eg, shell.run("monitor","top","alongtimeago") is the same as shell.run("monitor top alongtimeago"), and you can use whichever syntax happens to suit you. | |
Syntax | shell.run(string program [, string args1, string args2, ...]) |
Returns | boolean success |
Part of | ComputerCraft |
API | shell |
Examples
Example | |
Runs the program "myProgram" with arguments "test" and "ing": | |
Code |
shell.run("myProgram", "test", "ing") |
Output | The program myProgram with the arguments "test" and "ing". |
Example | |
Runs the program "monitor" along with the other arguments set in "myTable": | |
Code |
local myTable = {"monitor","left","worm"} shell.run( unpack(myTable) ) |