diff options
| author | tomas <tomas> | 2006-03-14 15:03:34 +0000 |
|---|---|---|
| committer | tomas <tomas> | 2006-03-14 15:03:34 +0000 |
| commit | dbb964ffd47dd73cb452ae7b5420d3f9bae31d29 (patch) | |
| tree | 128b831fe5644a9686719d1ec3bfccde22f6e5ef /doc | |
| parent | 9344c3933d79c88d927223c36e6fb1342d6387db (diff) | |
| download | luafilesystem-dbb964ffd47dd73cb452ae7b5420d3f9bae31d29.tar.gz luafilesystem-dbb964ffd47dd73cb452ae7b5420d3f9bae31d29.tar.bz2 luafilesystem-dbb964ffd47dd73cb452ae7b5420d3f9bae31d29.zip | |
Standardizing the return values in case of error
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/us/manual.html | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/doc/us/manual.html b/doc/us/manual.html index af8beae..319d6c5 100644 --- a/doc/us/manual.html +++ b/doc/us/manual.html | |||
| @@ -85,12 +85,15 @@ The compiled binary should be copied to a directory in your | |||
| 85 | 85 | ||
| 86 | <h2><a name="reference"></a>Reference</h2> | 86 | <h2><a name="reference"></a>Reference</h2> |
| 87 | 87 | ||
| 88 | <p>LuaFileSystem offers the following functions:</p> | 88 | <p> |
| 89 | LuaFileSystem offers the following functions: | ||
| 90 | </p> | ||
| 89 | 91 | ||
| 90 | <dl class="reference"> | 92 | <dl class="reference"> |
| 91 | <dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, aname])</code></strong></dt> | 93 | <dt><a name="attributes"></a><strong><code>lfs.attributes (filepath [, aname])</code></strong></dt> |
| 92 | <dd>Returns a table with the file attributes corresponding to | 94 | <dd>Returns a table with the file attributes corresponding to |
| 93 | <code>filepath</code>. | 95 | <code>filepath</code> (or <code>nil</code> followed by an error message |
| 96 | in case of error). | ||
| 94 | If the second optional argument is given, then only the value of the | 97 | If the second optional argument is given, then only the value of the |
| 95 | named attribute is returned (this use is equivalent to | 98 | named attribute is returned (this use is equivalent to |
| 96 | <code>lfs.attributes(filepath).aname</code>, but the table is not created | 99 | <code>lfs.attributes(filepath).aname</code>, but the table is not created |
| @@ -155,8 +158,12 @@ The compiled binary should be copied to a directory in your | |||
| 155 | plus an error string.</dd> | 158 | plus an error string.</dd> |
| 156 | 159 | ||
| 157 | <dt><a name="dir"></a><strong><code>lfs.dir (path)</code></strong></dt> | 160 | <dt><a name="dir"></a><strong><code>lfs.dir (path)</code></strong></dt> |
| 158 | <dd>Lua iterator over the entries of a given directory. Raises an | 161 | <dd> |
| 159 | error if <code>path</code> is not a directory.</dd> | 162 | Lua iterator over the entries of a given directory. |
| 163 | Each time the iterator is called it returns a string with an entry of the | ||
| 164 | directory; <code>nil</code> is returned when there is no more entries. | ||
| 165 | Raises an error if <code>path</code> is not a directory. | ||
| 166 | </dd> | ||
| 160 | 167 | ||
| 161 | <dt><a name="lock"></a><strong><code>lfs.lock (filehandle, mode[, start[, length]])</code></strong></dt> | 168 | <dt><a name="lock"></a><strong><code>lfs.lock (filehandle, mode[, start[, length]])</code></strong></dt> |
| 162 | <dd>Locks a file or a part of it. This function works on <em>open files</em>; the | 169 | <dd>Locks a file or a part of it. This function works on <em>open files</em>; the |
| @@ -166,20 +173,21 @@ The compiled binary should be copied to a directory in your | |||
| 166 | write/exclusive lock). The optional arguments <code>start</code> | 173 | write/exclusive lock). The optional arguments <code>start</code> |
| 167 | and <code>length</code> can be used to specify a starting point and | 174 | and <code>length</code> can be used to specify a starting point and |
| 168 | its length; both should be numbers.<br /> | 175 | its length; both should be numbers.<br /> |
| 169 | Returns a boolean indicating if the operation was successful; in | 176 | Returns <code>true</code> if the operation was successful; in |
| 170 | case of error, it returns <code>false</code> plus an error string. | 177 | case of error, it returns <code>nil</code> plus an error string. |
| 171 | </dd> | 178 | </dd> |
| 172 | 179 | ||
| 173 | <dt><a name="mkdir"></a><strong><code>lfs.mkdir (dirname)</code></strong></dt> | 180 | <dt><a name="mkdir"></a><strong><code>lfs.mkdir (dirname)</code></strong></dt> |
| 174 | <dd>Creates a new directory. The argument is the name of the new | 181 | <dd>Creates a new directory. The argument is the name of the new |
| 175 | directory.<br /> | 182 | directory.<br /> |
| 176 | Returns a boolean indicating whether the operation succeeds or not | 183 | Returns <code>true</code> if the operation was successful; |
| 177 | (in this case, an error string is returned too).</dd> | 184 | in case of error, it returns <code>nil</code> plus an error string. |
| 185 | </dd> | ||
| 178 | 186 | ||
| 179 | <dt><a name="rmdir"></a><strong><code>lfs.rmdir (dirname)</code></strong></dt> | 187 | <dt><a name="rmdir"></a><strong><code>lfs.rmdir (dirname)</code></strong></dt> |
| 180 | <dd>Removes an existing directory. The argument is the name of the directory.<br /> | 188 | <dd>Removes an existing directory. The argument is the name of the directory.<br /> |
| 181 | Returns a boolean indicating whether the operation succeeds or not | 189 | Returns <code>true</code> if the operation was successful; |
| 182 | (in this case, an error string is returned too).</dd> | 190 | in case of error, it returns <code>nil</code> plus an error string.</dd> |
| 183 | 191 | ||
| 184 | <dt><a name="touch"></a><strong><code>lfs.touch (filepath [, atime [, mtime]])</code></strong></dt> | 192 | <dt><a name="touch"></a><strong><code>lfs.touch (filepath [, atime [, mtime]])</code></strong></dt> |
| 185 | <dd>Set access and modification times of a file. This function is | 193 | <dd>Set access and modification times of a file. This function is |
| @@ -188,10 +196,11 @@ The compiled binary should be copied to a directory in your | |||
| 188 | and the third argument (<code>mtime</code>) is the modification time. | 196 | and the third argument (<code>mtime</code>) is the modification time. |
| 189 | Both times are provided in seconds (which should be generated with | 197 | Both times are provided in seconds (which should be generated with |
| 190 | Lua standard function <code>os.date</code>). | 198 | Lua standard function <code>os.date</code>). |
| 191 | If the modifition time is omitted, the access time provided is used; | 199 | If the modification time is omitted, the access time provided is used; |
| 192 | if both times are omitted, the current time is used.<br /> | 200 | if both times are omitted, the current time is used.<br /> |
| 193 | Returns a boolean indicating whether the operation succeeded or not | 201 | Returns <code>true</code> if the operation was successful; |
| 194 | (followed by an error string when it fails).</dd> | 202 | in case of error, it returns <code>nil</code> plus an error string. |
| 203 | </dd> | ||
| 195 | 204 | ||
| 196 | <dt><a name="unlock"></a><strong><code>lfs.unlock (filehandle[, start[, length]])</code></strong></dt> | 205 | <dt><a name="unlock"></a><strong><code>lfs.unlock (filehandle[, start[, length]])</code></strong></dt> |
| 197 | <dd>Unlocks a file or a part of it. This function works on | 206 | <dd>Unlocks a file or a part of it. This function works on |
| @@ -199,9 +208,9 @@ The compiled binary should be copied to a directory in your | |||
| 199 | argument. The optional arguments <code>start</code> and | 208 | argument. The optional arguments <code>start</code> and |
| 200 | <code>length</code> can be used to specify a starting point and its | 209 | <code>length</code> can be used to specify a starting point and its |
| 201 | length; both should be numbers.<br /> | 210 | length; both should be numbers.<br /> |
| 202 | Returns a boolean indicating if the operation was successful; in | 211 | Returns <code>true</code> if the operation was successful; |
| 203 | case of error, it returns <code>false</code> plus a string | 212 | in case of error, it returns <code>nil</code> plus an error string. |
| 204 | describing the error.</dd> | 213 | </dd> |
| 205 | </dl> | 214 | </dl> |
| 206 | 215 | ||
| 207 | </div> <!-- id="content" --> | 216 | </div> <!-- id="content" --> |
| @@ -211,7 +220,7 @@ The compiled binary should be copied to a directory in your | |||
| 211 | <div id="about"> | 220 | <div id="about"> |
| 212 | <p><a href="http://validator.w3.org/check?uri=referer"> | 221 | <p><a href="http://validator.w3.org/check?uri=referer"> |
| 213 | <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> | 222 | <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p> |
| 214 | <p><small>$Id: manual.html,v 1.28 2006/03/14 13:16:18 tomas Exp $</small></p> | 223 | <p><small>$Id: manual.html,v 1.29 2006/03/14 15:03:34 tomas Exp $</small></p> |
| 215 | </div> <!-- id="about" --> | 224 | </div> <!-- id="about" --> |
| 216 | 225 | ||
| 217 | </div> <!-- id="container" --> | 226 | </div> <!-- id="container" --> |
