Difference between revisions of "Fs.list"
From ComputerCraft Wiki
m |
(Update description to correct semantics for non-directories and use type template) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=fs.list | |name=fs.list | ||
− | |args= | + | |args={{Type|string}} path |
|api=fs | |api=fs | ||
− | |returns= | + | |returns={{Type|table}} list of files and folders in <var>path</var>. If <var>path</var> is not a directory, an empty table is returned. |
− | |desc=Returns a list of all the files contained in a directory, | + | |desc=Returns a list of all the files (including subdirectories but not their contents) contained in a directory, as a numerically indexed table. |
|examples= | |examples= | ||
{{Example | {{Example | ||
Line 15: | Line 15: | ||
end --End the loop | end --End the loop | ||
− | |output=A list of all files and folders in the root directory as a table. Note that fs.list() could also be inserted directly into ipairs() or pairs() | + | |output=A list of all files and folders in the root directory as a table. Note that fs.list() could also be inserted directly into ipairs() or pairs(). |
}} | }} | ||
}} | }} | ||
[[Category:Lua_Core_Functions]] | [[Category:Lua_Core_Functions]] |
Latest revision as of 19:43, 22 April 2013
Function fs.list | |
Returns a list of all the files (including subdirectories but not their contents) contained in a directory, as a numerically indexed table. | |
Syntax | fs.list(string path) |
Returns | table list of files and folders in path. If path is not a directory, an empty table is returned. |
Part of | ComputerCraft |
API | fs |