fs.getName

From ComputerCraft Wiki
Revision as of 18:46, 28 November 2012 by AfterLifeLochie (Talk | contribs) (Moved to CAT:LuaCoreFunctions)

Jump to: navigation, search


Grid Redstone.png  Function fs.getName
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

Grid paper.png  Example
Gets the last path component of a file
Code
print(fs.getName("rom/apis/colors"))
Output colors