Difference between revisions of "Fs.getDrive"
From ComputerCraft Wiki
(More possible return values related to floppies) |
m (Use type template) |
||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=fs.getDrive | |name=fs.getDrive | ||
− | |args= | + | |args={{Type|string}} path |
|api=fs | |api=fs | ||
− | |returns= | + | |returns={{Type|string}} the type of storage medium holding the 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/] | |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= |
Revision as of 19:43, 22 April 2013
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, or nil if the path does not exist |
Part of | ComputerCraft |
API | fs |
Examples
Example | |
Checks that the standard "startup" file is stored in ROM | |
Code |
print(fs.getDrive("rom/startup")) |
Output | rom |