Difference between revisions of "Fs.getName"

From ComputerCraft Wiki
Jump to: navigation, search
(Create page)
 
m (Moved to CAT:LuaCoreFunctions)
Line 13: Line 13:
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Revision as of 18:46, 28 November 2012


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