Difference between revisions of "Shell.programs"

From ComputerCraft Wiki
Jump to: navigation, search
m (Forgot to add a space at the front to declare it as code :-/)
(Organized the page, used Function template.)
Line 1: Line 1:
{{Stub}}  
+
{{lowercase}}
Shell.programs is a shell command used to list possible programs you can run, from programs that are in your current directory and programs that have an alias.
+
{{Function
 +
|name=shell.programs
 +
|args=[<nowiki></nowiki>{{type|boolean}} hidden]
 +
|returns={{type|table}} programs
 +
|api=Shell
 +
|addon=ComputerCraft
 +
|desc=Returns a table of files in the current directory and in rom/programs. If ''hidden'' is true, will also show files that begin with a period (hidden files).
 +
|examples=
 +
{{Example
 +
|desc=The program lists files in the current directory and in rom/programs, not including files that are prefixed with a period.
 +
|code=textutils.tabulate(shell.programs())
 +
|output=A tabulated list of programs. This is basically the 'programs' program.
 +
}}
 +
{{Example
 +
|desc=The program lists all files in the current directory and in rom/programs.
 +
|code=textutils.tabulate(shell.programs(true))
 +
|output=A tabulated list of programs. This is basically the 'programs' program, but it shows hidden files too.
 +
}}
 +
}}
  
== Example ==
+
[[Category:API_Functions]]
textutils.tabulate(shell.programs()) -- Would list all the programs like running the program "programs"
+
textutils.tabulate(shell.programs(true)) -- Would list all programs including hidden ones that have a . prefix
+

Revision as of 14:40, 2 May 2013


Grid Redstone.png  Function shell.programs
Returns a table of files in the current directory and in rom/programs. If hidden is true, will also show files that begin with a period (hidden files).
Syntax shell.programs([boolean hidden])
Returns table programs
Part of ComputerCraft
API Shell

Examples

Grid paper.png  Example
The program lists files in the current directory and in rom/programs, not including files that are prefixed with a period.
Code
textutils.tabulate(shell.programs())
Output A tabulated list of programs. This is basically the 'programs' program.



Grid paper.png  Example
The program lists all files in the current directory and in rom/programs.
Code
textutils.tabulate(shell.programs(true))
Output A tabulated list of programs. This is basically the 'programs' program, but it shows hidden files too.