Difference between revisions of "Fs.list"
From ComputerCraft Wiki
(Add a description) |
|||
| Line 1: | Line 1: | ||
| + | {{lowercase}} | ||
{{Function | {{Function | ||
|name=fs.list | |name=fs.list | ||
|args=[[string (type)|string]] path | |args=[[string (type)|string]] path | ||
|api=fs | |api=fs | ||
| − | |returns=[[table (type)|table]] list of files and folders in | + | |returns=[[table (type)|table]] list of files and folders in <var>path</var>, which must be a directory |
| + | |desc=Returns a list of all the files contained in a directory | ||
|examples= | |examples= | ||
{{Example | {{Example | ||
|desc=Displays a list of all files and folders in the root directory of a computer | |desc=Displays a list of all files and folders in the root directory of a computer | ||
| − | |code=for k,v in ipairs(fs.list(" | + | |code=for k, v in ipairs(fs.list("")) do |
print(v) | print(v) | ||
end | end | ||
| − | |output=A list of all files and folders in | + | |output=A list of all files and folders in the root directory |
}} | }} | ||
}} | }} | ||
Revision as of 03:46, 12 March 2012
| Returns a list of all the files contained in a directory | |
| Syntax | fs.list(string path) |
| Returns | table list of files and folders in path, which must be a directory |
| Part of | ComputerCraft |
| API | fs |
Examples
| Displays a list of all files and folders in the root directory of a computer | |
| Code |
for k, v in ipairs(fs.list("")) do
print(v)
end
|
| Output | A list of all files and folders in the root directory |