Difference between revisions of "Fs.getDrive"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
(More possible return values related to floppies)
Line 4: Line 4:
 
|args=[[string (type)|string]] path
 
|args=[[string (type)|string]] path
 
|api=fs
 
|api=fs
|returns=[[string]] the type of storage medium holding the path, as of ComputerCraft 1.3 one of "rom" or "hdd"[http://www.computercraft.info/forums2/index.php?/topic/578-13-fsgetdrive-returns-wrong-answer/]
+
|returns=[[string]] the type of storage medium holding the path
|desc=Returns the storage medium holding a path, or nil if the path does not exist
+
|desc=Returns the storage medium holding a path, or [[nil]] if the path does not exist. This is one of “hdd” if the path is stored on the computer’s local hard drive, “rom” if the path is in ROM, or the side on which a disk drive is attached if the path is on a [[Floppy Disk]]. As of ComputerCraft 1.52, a network-attached disk drive with a floppy in it returns the side of the computer on which the modem is attached, rather than the network name of the disk drive; presumably this is a bug.[http://www.computercraft.info/forums2/index.php?/topic/12369-mc-151-cc-152-fsgetdrive-wrong-answer-for-network-drives/]
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Revision as of 19:08, 21 April 2013


Grid Redstone.png  Function fs.getDrive
Returns the storage medium holding a path, or nil if the path does not exist. This is one of “hdd” if the path is stored on the computer’s local hard drive, “rom” if the path is in ROM, or the side on which a disk drive is attached if the path is on a Floppy Disk. As of ComputerCraft 1.52, a network-attached disk drive with a floppy in it returns the side of the computer on which the modem is attached, rather than the network name of the disk drive; presumably this is a bug.[1]
Syntax fs.getDrive(string path)
Returns string the type of storage medium holding the path
Part of ComputerCraft
API fs

Examples

Grid paper.png  Example
Checks that the standard "startup" file is stored in ROM
Code
print(fs.getDrive("rom/startup"))
Output rom