Difference between revisions of "Fs.combine"
From ComputerCraft Wiki
m (Moved to CAT:LuaCoreFunctions) |
(Corrected broken links.) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=fs.combine | |name=fs.combine | ||
− | |args=[[ | + | |args=[[String_(type)|string]] basePath, [[String_(type)|string]] localPath |
|api=fs | |api=fs | ||
− | |returns=[[string]] the combined path | + | |returns=[[String_(type)|string]] the combined path |
|desc=Combines two paths, such that the new path consists of all the components of <var>localPath</var> inside all the components of <var>basePath</var> (neither path needs to exist; this function only manipulates strings and does not touch the filesystem) | |desc=Combines two paths, such that the new path consists of all the components of <var>localPath</var> inside all the components of <var>basePath</var> (neither path needs to exist; this function only manipulates strings and does not touch the filesystem) | ||
|examples= | |examples= |
Revision as of 12:22, 30 November 2012
Function fs.combine | |
Combines two paths, such that the new path consists of all the components of localPath inside all the components of basePath (neither path needs to exist; this function only manipulates strings and does not touch the filesystem) | |
Syntax | fs.combine(string basePath, string localPath) |
Returns | string the combined path |
Part of | ComputerCraft |
API | fs |
Examples
Example | |
An empty first path refers to the root directory, so the second path is returned | |
Code |
print(fs.combine("", "c/d")) |
Output | c/d |
Example | |
An empty second path refers to the first path directly, so the first path is returned | |
Code |
print(fs.combine("a/b", "")) |
Output | a/b |
Example | |
The last two examples make sense combined, returning the empty string (referring to the root directory) | |
Code |
print(fs.combine("", "")) |