Acrescimo de documentacao da lfs.touch.

Adaptacao para a versao 1.1.
This commit is contained in:
tomas
2005-01-24 10:59:58 +00:00
parent 2540f6cbdb
commit 5f942164a0
2 changed files with 44 additions and 23 deletions

View File

@@ -53,8 +53,7 @@ systems offered by the standard Lua distribution.</p>
<p>LuaFileSystem offers the following functions:</p>
<ul>
<li style="list-style: none"><a name="attributes"></a></li>
<a name="attributes"></a>
<li><b><tt>lfs.attributes (filepath)</tt></b><br>
Obtains the file attributes. The attributes are:
@@ -77,25 +76,31 @@ on;<br>
<i>blksize</i>, optimal file system I/O blocksize; (Unix only)<br>
</div>
Returns a table with file attributes described above. <a name=
"chdir"></a></li>
Returns a table with file attributes described above.
</li>
<a name="chdir"></a>
<li><b><tt>lfs.chdir (path)</tt></b><br>
Changes the current working directory to the given
<tt>path</tt>.<br>
Returns <tt>true</tt> in case of success or <tt>nil</tt> plus an
error string. <a name="getcwd"></a></li>
error string.
</li>
<a name="getcwd"></a>
<li><b><tt>lfs.currentdir ()</tt></b><br>
Returns a string with the current working directory or
<code>nil</code> plus an error string. <a name="dir"></a></li>
<code>nil</code> plus an error string.
</li>
<a name="dir"></a>
<li><b><tt>lfs.dir (path)</tt></b><br>
Lua iterator over the entries of a given directory. Raises an
error if <tt>path</tt> is not a directory. <a name="lock"></a></li>
error if <tt>path</tt> is not a directory.
</li>
<li><b><tt>lfs.lock (filehandle, mode[, start[,
length]])</tt></b><br>
<a name="lock"></a>
<li><b><tt>lfs.lock (filehandle, mode[, start[, length]])</tt></b><br>
Locks a file or a part of it. This function works on <em>open
files</em>; the file handle should be specified as the first
argument. The string <code>mode</code> could be either
@@ -105,15 +110,32 @@ and <code>length</code> can be used to specify a starting point and
its length; both should be numbers.<br>
Returns a boolean indicating if the operation was successful; in
case of error, it returns <code>false</code> plus an error string.
<a name="mkdir"></a></li>
</li>
<a name="mkdir"></a>
<li><b><tt>lfs.mkdir (dirname)</tt></b><br>
Creates a new directory. The argument is the name of the new
directory.<br>
Returns a boolean indicating whether the operation succeeds or not
(in this case, an error string is returned too). <a name=
"unlock"></a></li>
(in this case, an error string is returned too).
</li>
<a name="touch"></a>
<li><b><tt>lfs.touch (filepath [, atime [, mtime]])</tt></b><br>
Set access and modification times of a file.
This function is a bind to <tt>utime</tt> function.
The first argument is the filename,
the second argument is the access time,
and the third argument is the modification time.
Both times are provided in seconds (which should be generated with
Lua standard function <tt>os.date</tt>).
If the modifition time is omitted, the access time provided is used;
if both times are omitted, the current time is used.<br>
Returns a boolean indicating whethet the operation succeeds or not
(followed by an error string in case it fails).
</li>
<a name="unlock"></a>
<li><b><tt>lfs.unlock (filehandle[, start[, length]])</tt></b><br>
Unlocks a file or a part of it. This function works on <em>open
files</em>; the file handle should be specified as the first
@@ -126,7 +148,6 @@ describing the error.</li>
</ul>
<a name="example"></a>
<h2>Example</h2>
<pre>