fs.complete
From ComputerCraft Wiki
Revision as of 07:16, 5 July 2015 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=fs.complete |args= {{Type|string}} file / directory, {{Type|string}} parent folder [, {{Type|boolean}} include files] [, {{Type|boolean}} includ...")
Function fs.complete | |
Added by ComputerCraft 1.74, fs.complete() can be passed a partial file or directory name, and returns a numerically indexed table containing strings that could be used to complete it.
If "include files" is set to false, only directory names will be considered. If "include slashes" is set to true, each possible directory name will be represented in the list twice - once with a trailing forward slash (/), and once without (consecutively, and in that order). Both of these optional parameters default to true if omitted. Note that fs.complete() is case-sensitive, even if the file system it's being used with isn't. fs.find() is a similar function, although it provides matched file / folder names in full. See also: textutils.complete(), shell.complete(), shell.setCompletionFunction(), shell.completeProgram() and help.completeTopic(). | |
Syntax | fs.complete(string file / directory, string parent folder [, boolean include files] [, boolean include slashes]) |
Returns | table completion list |
Part of | ComputerCraft |
API | fs |
Examples
Example | |
Prints a list of strings that could be combined with "p" to produce file names in the rom/apis directory. | |
Code |
textutils.tabulate( fs.complete( "p", "rom/apis" ) ) |
Output | aintutils arallel eripheral (which could be concatenated to get the names of the paintutils, parallel and peripheral APIs). |