fs.getName
From ComputerCraft Wiki
| Returns the last path component (forward-slash-separated) component of a path (which need not exist) | |
| Syntax | fs.getName(string path) |
| Returns | string the last path component of the path, or the string "root" if the path refers to the root directory |
| Part of | ComputerCraft |
| API | fs |
Examples
| Gets the last path component of a file | |
| Code |
print(fs.getName("rom/apis/colors"))
|
| Output | colors |