fs.combine
From ComputerCraft Wiki
Revision as of 18:46, 28 November 2012 by AfterLifeLochie (Talk | contribs) (Moved to CAT:LuaCoreFunctions)
| 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
| An empty first path refers to the root directory, so the second path is returned | |
| Code |
print(fs.combine("", "c/d"))
|
| Output | c/d |
| 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 |
| The last two examples make sense combined, returning the empty string (referring to the root directory) | |
| Code |
print(fs.combine("", ""))
|