Difference between revisions of "Fs.isReadOnly"

From ComputerCraft Wiki
Jump to: navigation, search
(Got the return values backwards)
(Copy description from API page, fix return formatting, and use type template)
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
{{Function
 
{{Function
 
|name=fs.isReadOnly
 
|name=fs.isReadOnly
|args=[[string (type)|string]] path
+
|args={{Type|string}} path
 
|api=fs
 
|api=fs
|returns=[[boolean]] <code>false</code> if <var>path</var> can be written to, or <var>true</var> if not
+
|returns={{Type|boolean}} <code>false</code> if <var>path</var> can be written to, or <code>true</code> if not
|desc=Checks whether a path can be written to (the path need not exist in order to perform this test)
+
|desc=Checks if a path is read-only (i.e. cannot be modified). The path need not exist in order to perform this test. Note that the root directory and the mount points of any floppy disks are considered read-only, perhaps because they cannot ''themselves'' be modified, only their ''contents'' can be.
 
|examples=
 
|examples=
 
{{Example
 
{{Example
Line 13: Line 13:
 
}}
 
}}
 
}}
 
}}
 +
 +
[[Category:Lua_Core_Functions]]

Latest revision as of 19:43, 22 April 2013


Grid Redstone.png  Function fs.isReadOnly
Checks if a path is read-only (i.e. cannot be modified). The path need not exist in order to perform this test. Note that the root directory and the mount points of any floppy disks are considered read-only, perhaps because they cannot themselves be modified, only their contents can be.
Syntax fs.isReadOnly(string path)
Returns boolean false if path can be written to, or true if not
Part of ComputerCraft
API fs

Examples

Grid paper.png  Example
Checks that the "rom" directory is read-only, as its name implies
Code
print(fs.isReadOnly("rom"))
Output true