mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-23 19:43:06 +00:00
Melhorias na documentacao.
This commit is contained in:
@@ -56,24 +56,41 @@ LuaFileSystem offers the following functions:
|
|||||||
<ul>
|
<ul>
|
||||||
<a name="attributes"></a>
|
<a name="attributes"></a>
|
||||||
<li> <b><tt>lfs.attributes (filepath)</tt></b> <br>
|
<li> <b><tt>lfs.attributes (filepath)</tt></b> <br>
|
||||||
Returns a table with file attributes.
|
Obtains the file attributes.
|
||||||
|
The attributes are:
|
||||||
|
<ul>
|
||||||
|
<i>dev</i>, device inode resides on;<br>
|
||||||
|
<i>ino</i>, inode's number;<br>
|
||||||
|
<i>mode</i>, inode protection mode (<small>values could be
|
||||||
|
<tt>file</tt>, <tt>directory</tt>, <tt>link</tt>, <tt>socket</tt>, <tt>named pipe</tt>, <tt>char device</tt>, <tt>block device</tt> or <tt>other</tt></small>);<br>
|
||||||
|
<i>nlink</i>, number of hard links to the file;<br>
|
||||||
|
<i>uid</i>, user-id of owner;<br>
|
||||||
|
<i>gid</i>, group-id of owner;<br>
|
||||||
|
<i>rdev</i>, device type, for special file inode;<br>
|
||||||
|
<i>access</i>, time of last access;<br>
|
||||||
|
<i>modification</i>, time of last data modification;<br>
|
||||||
|
<i>change</i>, time of last file status change;<br>
|
||||||
|
<i>size</i>, file size, in bytes;<br>
|
||||||
|
<i>blocks</i>, block allocated for file;<br>
|
||||||
|
<i>blksize</i>, optimal file system I/O blocksize;<br>
|
||||||
|
</ul>
|
||||||
|
Returns a table with file attributes described above.
|
||||||
|
|
||||||
<a name="chdir"></a>
|
<a name="chdir"></a>
|
||||||
<li> <b><tt>lfs.chdir (path)</tt></b> <br>
|
<li> <b><tt>lfs.chdir (path)</tt></b> <br>
|
||||||
Changes the current
|
Changes the current working directory to the given <tt>path</tt>.<br>
|
||||||
working directory to the given <tt>path</tt>.
|
|
||||||
Returns <tt>true</tt> in case of success or <tt>nil</tt> plus an error
|
Returns <tt>true</tt> in case of success or <tt>nil</tt> plus an error
|
||||||
string.
|
string.
|
||||||
|
|
||||||
<a name="getcwd"></a>
|
<a name="getcwd"></a>
|
||||||
<li> <b><tt>lfs.currentdir ()</tt></b> <br>
|
<li> <b><tt>lfs.currentdir ()</tt></b> <br>
|
||||||
Returns the current
|
Returns a string with the current working directory or
|
||||||
working directory or <code>nil</code> plus an error string.
|
<code>nil</code> plus an error string.
|
||||||
|
|
||||||
<a name="dir"></a>
|
<a name="dir"></a>
|
||||||
<li> <b><tt>lfs.dir (path)</tt></b> <br>
|
<li> <b><tt>lfs.dir (path)</tt></b> <br>
|
||||||
Lua iterator over the entries
|
Lua iterator over the entries of a given directory.
|
||||||
of a given directory.
|
Raises an error if <tt>path</tt> is not a directory.
|
||||||
|
|
||||||
<a name="lock"></a>
|
<a name="lock"></a>
|
||||||
<li> <b><tt>lfs.lock (filehandle, mode[, start[, length]])</tt></b> <br>
|
<li> <b><tt>lfs.lock (filehandle, mode[, start[, length]])</tt></b> <br>
|
||||||
@@ -84,15 +101,16 @@ LuaFileSystem offers the following functions:
|
|||||||
read/shared lock) or <code>w</code> (for a write/exclusive lock).
|
read/shared lock) or <code>w</code> (for a write/exclusive lock).
|
||||||
The optional arguments <code>start</code> and <code>length</code> can be
|
The optional arguments <code>start</code> and <code>length</code> can be
|
||||||
used to specify a starting point and its length;
|
used to specify a starting point and its length;
|
||||||
both should be numbers.
|
both should be numbers.<br>
|
||||||
Returns a boolean indicating if the operation was successful;
|
Returns a boolean indicating if the operation was successful;
|
||||||
in case of error, it returns <code>false</code> plus an error string.
|
in case of error, it returns <code>false</code> plus an error string.
|
||||||
|
|
||||||
<a name="mkdir"></a>
|
<a name="mkdir"></a>
|
||||||
<li> <b><tt>lfs.mkdir (dirname)</tt></b> <br>
|
<li> <b><tt>lfs.mkdir (dirname)</tt></b> <br>
|
||||||
Creates a new directory.
|
Creates a new directory.
|
||||||
The argument is the name of the new directory.
|
The argument is the name of the new directory.<br>
|
||||||
Returns a boolean indicating whether the operation succeeds or not.
|
Returns a boolean indicating whether the operation succeeds or not
|
||||||
|
(in this case, an error string is returned too).
|
||||||
|
|
||||||
<a name="unlock"></a>
|
<a name="unlock"></a>
|
||||||
<li> <b><tt>lfs.unlock (filehandle[, start[, length]])</tt></b> <br>
|
<li> <b><tt>lfs.unlock (filehandle[, start[, length]])</tt></b> <br>
|
||||||
@@ -101,8 +119,8 @@ LuaFileSystem offers the following functions:
|
|||||||
the file handle should be specified as the first argument.
|
the file handle should be specified as the first argument.
|
||||||
The optional arguments <code>start</code> and <code>length</code> can be
|
The optional arguments <code>start</code> and <code>length</code> can be
|
||||||
used to specify a starting point and its length;
|
used to specify a starting point and its length;
|
||||||
both should be numbers.
|
both should be numbers.<br>
|
||||||
This function returns a boolean indicating if the operation was successful;
|
Returns a boolean indicating if the operation was successful;
|
||||||
in case of error, it returns <code>false</code> plus a string describing the
|
in case of error, it returns <code>false</code> plus a string describing the
|
||||||
error.
|
error.
|
||||||
|
|
||||||
@@ -167,7 +185,7 @@ attrdir (".")
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
<small>
|
<small>
|
||||||
$Id: manual.html,v 1.5 2004/11/01 15:27:13 tomas Exp $
|
$Id: manual.html,v 1.6 2004/11/05 10:37:29 tomas Exp $
|
||||||
</small>
|
</small>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
** lfs.lock (fh, mode)
|
** lfs.lock (fh, mode)
|
||||||
** lfs.unlock (fh)
|
** lfs.unlock (fh)
|
||||||
**
|
**
|
||||||
** $Id: lfs.c,v 1.10 2004/11/04 22:21:28 tuler Exp $
|
** $Id: lfs.c,v 1.11 2004/11/05 10:37:29 tomas Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -403,7 +403,7 @@ static int file_info (lua_State *L) {
|
|||||||
lua_pushliteral (L, "mode");
|
lua_pushliteral (L, "mode");
|
||||||
lua_pushstring (L, mode2string (info.st_mode));
|
lua_pushstring (L, mode2string (info.st_mode));
|
||||||
lua_rawset (L, -3);
|
lua_rawset (L, -3);
|
||||||
/* number or hard links to the file */
|
/* number of hard links to the file */
|
||||||
lua_pushliteral (L, "nlink");
|
lua_pushliteral (L, "nlink");
|
||||||
lua_pushnumber (L, (lua_Number)info.st_nlink);
|
lua_pushnumber (L, (lua_Number)info.st_nlink);
|
||||||
lua_rawset (L, -3);
|
lua_rawset (L, -3);
|
||||||
|
|||||||
Reference in New Issue
Block a user