diff options
author | tuler <tuler> | 2004-11-10 14:09:45 +0000 |
---|---|---|
committer | tuler <tuler> | 2004-11-10 14:09:45 +0000 |
commit | 688efd472ce1a1ea612a3d1720a19a2f65b383a5 (patch) | |
tree | a5034c395dece4ab29ebfbb01b423307dcb91c54 /doc | |
parent | c9286d40fe9cacfa022e6ee98905dda9eec6d8b1 (diff) | |
download | luafilesystem-688efd472ce1a1ea612a3d1720a19a2f65b383a5.tar.gz luafilesystem-688efd472ce1a1ea612a3d1720a19a2f65b383a5.tar.bz2 luafilesystem-688efd472ce1a1ea612a3d1720a19a2f65b383a5.zip |
alguns atributos sao especificos de Unix.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/us/manual.html | 384 |
1 files changed, 192 insertions, 192 deletions
diff --git a/doc/us/manual.html b/doc/us/manual.html index 3afde68..ec92531 100644 --- a/doc/us/manual.html +++ b/doc/us/manual.html | |||
@@ -1,192 +1,192 @@ | |||
1 | <! See Copyright Notice in license.html> | 1 | <! See Copyright Notice in license.html> |
2 | <html> | 2 | <html> |
3 | 3 | ||
4 | <head> | 4 | <head> |
5 | <title>LuaFileSystem</title> | 5 | <title>LuaFileSystem</title> |
6 | <style type="text/css"> | 6 | <style type="text/css"> |
7 | ul { list-style-type: disc }; | 7 | ul { list-style-type: disc }; |
8 | </style> | 8 | </style> |
9 | </head> | 9 | </head> |
10 | 10 | ||
11 | <body bgcolor="#FFFFFF"> | 11 | <body bgcolor="#FFFFFF"> |
12 | 12 | ||
13 | <hr> | 13 | <hr> |
14 | 14 | ||
15 | <center> | 15 | <center> |
16 | <table border=0 cellspacing=2 cellpadding=2> | 16 | <table border=0 cellspacing=2 cellpadding=2> |
17 | <tr><td align=center><a href="http://www.keplerproject.org/luafilesystem"> | 17 | <tr><td align=center><a href="http://www.keplerproject.org/luafilesystem"> |
18 | <img border=0 alt="LuaFileSystem logo" src="luafilesystem.png"></a> | 18 | <img border=0 alt="LuaFileSystem logo" src="luafilesystem.png"></a> |
19 | <tr><td align=center><big><b>LuaFileSystem Reference Manual</b></big> | 19 | <tr><td align=center><big><b>LuaFileSystem Reference Manual</b></big> |
20 | <tr><td align=center valign=top>File system library for the | 20 | <tr><td align=center valign=top>File system library for the |
21 | <a href="http://www.lua.org">Lua</a> | 21 | <a href="http://www.lua.org">Lua</a> |
22 | programming language | 22 | programming language |
23 | </table> | 23 | </table> |
24 | </center> | 24 | </center> |
25 | <p> | 25 | <p> |
26 | 26 | ||
27 | <center><small> | 27 | <center><small> |
28 | <a href="index.html">home</a> · | 28 | <a href="index.html">home</a> · |
29 | <a href="#introduction">introduction</a> · | 29 | <a href="#introduction">introduction</a> · |
30 | <a href="#reference">reference</a> · | 30 | <a href="#reference">reference</a> · |
31 | <a href="#example">example</a> | 31 | <a href="#example">example</a> |
32 | </small></center> | 32 | </small></center> |
33 | <p> | 33 | <p> |
34 | 34 | ||
35 | <hr> | 35 | <hr> |
36 | 36 | ||
37 | <a name="introduction"></a> | 37 | <a name="introduction"></a> |
38 | <h2>Introduction</h2> | 38 | <h2>Introduction</h2> |
39 | 39 | ||
40 | <p> | 40 | <p> |
41 | LuaFileSystem is a <a href="http://www.lua.org">Lua</a> library | 41 | LuaFileSystem is a <a href="http://www.lua.org">Lua</a> library |
42 | developed to complement the set of functions related to file systems offered | 42 | developed to complement the set of functions related to file systems offered |
43 | by the standard Lua distribution. | 43 | by the standard Lua distribution. |
44 | <p> | 44 | <p> |
45 | LuaFileSystem is free software and uses the same | 45 | LuaFileSystem is free software and uses the same |
46 | <a href="license.html">license</a> | 46 | <a href="license.html">license</a> |
47 | as Lua 5.0. | 47 | as Lua 5.0. |
48 | </p> | 48 | </p> |
49 | 49 | ||
50 | 50 | ||
51 | <a name="reference"></a> | 51 | <a name="reference"></a> |
52 | <h2>Reference</h2> | 52 | <h2>Reference</h2> |
53 | 53 | ||
54 | <p> | 54 | <p> |
55 | LuaFileSystem offers the following functions: | 55 | LuaFileSystem offers the following functions: |
56 | <ul> | 56 | <ul> |
57 | <a name="attributes"></a> | 57 | <a name="attributes"></a> |
58 | <li> <b><tt>lfs.attributes (filepath)</tt></b> <br> | 58 | <li> <b><tt>lfs.attributes (filepath)</tt></b> <br> |
59 | Obtains the file attributes. | 59 | Obtains the file attributes. |
60 | The attributes are: | 60 | The attributes are: |
61 | <ul> | 61 | <ul> |
62 | <i>dev</i>, device inode resides on;<br> | 62 | <i>dev</i>, device inode resides on;<br> |
63 | <i>ino</i>, inode's number;<br> | 63 | <i>ino</i>, inode's number;<br> |
64 | <i>mode</i>, inode protection mode (<small>values could be | 64 | <i>mode</i>, inode protection mode (<small>values could be |
65 | <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> | 65 | <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> |
66 | <i>nlink</i>, number of hard links to the file;<br> | 66 | <i>nlink</i>, number of hard links to the file;<br> |
67 | <i>uid</i>, user-id of owner;<br> | 67 | <i>uid</i>, user-id of owner;<br> |
68 | <i>gid</i>, group-id of owner;<br> | 68 | <i>gid</i>, group-id of owner;<br> |
69 | <i>rdev</i>, device type, for special file inode;<br> | 69 | <i>rdev</i>, device type, for special file inode;<br> |
70 | <i>access</i>, time of last access;<br> | 70 | <i>access</i>, time of last access;<br> |
71 | <i>modification</i>, time of last data modification;<br> | 71 | <i>modification</i>, time of last data modification;<br> |
72 | <i>change</i>, time of last file status change;<br> | 72 | <i>change</i>, time of last file status change;<br> |
73 | <i>size</i>, file size, in bytes;<br> | 73 | <i>size</i>, file size, in bytes;<br> |
74 | <i>blocks</i>, block allocated for file;<br> | 74 | <i>blocks</i>, block allocated for file; (Unix only)<br> |
75 | <i>blksize</i>, optimal file system I/O blocksize;<br> | 75 | <i>blksize</i>, optimal file system I/O blocksize; (Unix only)<br> |
76 | </ul> | 76 | </ul> |
77 | Returns a table with file attributes described above. | 77 | Returns a table with file attributes described above. |
78 | 78 | ||
79 | <a name="chdir"></a> | 79 | <a name="chdir"></a> |
80 | <li> <b><tt>lfs.chdir (path)</tt></b> <br> | 80 | <li> <b><tt>lfs.chdir (path)</tt></b> <br> |
81 | Changes the current working directory to the given <tt>path</tt>.<br> | 81 | Changes the current working directory to the given <tt>path</tt>.<br> |
82 | Returns <tt>true</tt> in case of success or <tt>nil</tt> plus an error | 82 | Returns <tt>true</tt> in case of success or <tt>nil</tt> plus an error |
83 | string. | 83 | string. |
84 | 84 | ||
85 | <a name="getcwd"></a> | 85 | <a name="getcwd"></a> |
86 | <li> <b><tt>lfs.currentdir ()</tt></b> <br> | 86 | <li> <b><tt>lfs.currentdir ()</tt></b> <br> |
87 | Returns a string with the current working directory or | 87 | Returns a string with the current working directory or |
88 | <code>nil</code> plus an error string. | 88 | <code>nil</code> plus an error string. |
89 | 89 | ||
90 | <a name="dir"></a> | 90 | <a name="dir"></a> |
91 | <li> <b><tt>lfs.dir (path)</tt></b> <br> | 91 | <li> <b><tt>lfs.dir (path)</tt></b> <br> |
92 | Lua iterator over the entries of a given directory. | 92 | Lua iterator over the entries of a given directory. |
93 | Raises an error if <tt>path</tt> is not a directory. | 93 | Raises an error if <tt>path</tt> is not a directory. |
94 | 94 | ||
95 | <a name="lock"></a> | 95 | <a name="lock"></a> |
96 | <li> <b><tt>lfs.lock (filehandle, mode[, start[, length]])</tt></b> <br> | 96 | <li> <b><tt>lfs.lock (filehandle, mode[, start[, length]])</tt></b> <br> |
97 | Locks a file or a part of it. | 97 | Locks a file or a part of it. |
98 | This function works on <em>open files</em>; | 98 | This function works on <em>open files</em>; |
99 | the file handle should be specified as the first argument. | 99 | the file handle should be specified as the first argument. |
100 | The string <code>mode</code> could be either <code>r</code> (for a | 100 | The string <code>mode</code> could be either <code>r</code> (for a |
101 | read/shared lock) or <code>w</code> (for a write/exclusive lock). | 101 | read/shared lock) or <code>w</code> (for a write/exclusive lock). |
102 | The optional arguments <code>start</code> and <code>length</code> can be | 102 | The optional arguments <code>start</code> and <code>length</code> can be |
103 | used to specify a starting point and its length; | 103 | used to specify a starting point and its length; |
104 | both should be numbers.<br> | 104 | both should be numbers.<br> |
105 | Returns a boolean indicating if the operation was successful; | 105 | Returns a boolean indicating if the operation was successful; |
106 | in case of error, it returns <code>false</code> plus an error string. | 106 | in case of error, it returns <code>false</code> plus an error string. |
107 | 107 | ||
108 | <a name="mkdir"></a> | 108 | <a name="mkdir"></a> |
109 | <li> <b><tt>lfs.mkdir (dirname)</tt></b> <br> | 109 | <li> <b><tt>lfs.mkdir (dirname)</tt></b> <br> |
110 | Creates a new directory. | 110 | Creates a new directory. |
111 | The argument is the name of the new directory.<br> | 111 | The argument is the name of the new directory.<br> |
112 | Returns a boolean indicating whether the operation succeeds or not | 112 | Returns a boolean indicating whether the operation succeeds or not |
113 | (in this case, an error string is returned too). | 113 | (in this case, an error string is returned too). |
114 | 114 | ||
115 | <a name="unlock"></a> | 115 | <a name="unlock"></a> |
116 | <li> <b><tt>lfs.unlock (filehandle[, start[, length]])</tt></b> <br> | 116 | <li> <b><tt>lfs.unlock (filehandle[, start[, length]])</tt></b> <br> |
117 | Unlocks a file or a part of it. | 117 | Unlocks a file or a part of it. |
118 | This function works on <em>open files</em>; | 118 | This function works on <em>open files</em>; |
119 | the file handle should be specified as the first argument. | 119 | the file handle should be specified as the first argument. |
120 | The optional arguments <code>start</code> and <code>length</code> can be | 120 | The optional arguments <code>start</code> and <code>length</code> can be |
121 | used to specify a starting point and its length; | 121 | used to specify a starting point and its length; |
122 | both should be numbers.<br> | 122 | both should be numbers.<br> |
123 | Returns a boolean indicating if the operation was successful; | 123 | Returns a boolean indicating if the operation was successful; |
124 | in case of error, it returns <code>false</code> plus a string describing the | 124 | in case of error, it returns <code>false</code> plus a string describing the |
125 | error. | 125 | error. |
126 | 126 | ||
127 | </ul> | 127 | </ul> |
128 | 128 | ||
129 | 129 | ||
130 | <a name="example"></a> | 130 | <a name="example"></a> |
131 | <h2>Example</h2> | 131 | <h2>Example</h2> |
132 | 132 | ||
133 | <pre> | 133 | <pre> |
134 | require"lfs" | 134 | require"lfs" |
135 | 135 | ||
136 | function attrdir (path) | 136 | function attrdir (path) |
137 | for file in lfs.dir(path) do | 137 | for file in lfs.dir(path) do |
138 | if file ~= "." and file ~= ".." then | 138 | if file ~= "." and file ~= ".." then |
139 | local f = path..'/'..file | 139 | local f = path..'/'..file |
140 | print ("\t "..f) | 140 | print ("\t "..f) |
141 | local attr = lfs.attributes (f) | 141 | local attr = lfs.attributes (f) |
142 | assert (type(attr) == "table") | 142 | assert (type(attr) == "table") |
143 | if attr.mode == "directory" then | 143 | if attr.mode == "directory" then |
144 | attrdir (f) | 144 | attrdir (f) |
145 | else | 145 | else |
146 | for name, value in pairs(attr) do | 146 | for name, value in pairs(attr) do |
147 | print (name, value) | 147 | print (name, value) |
148 | end | 148 | end |
149 | end | 149 | end |
150 | end | 150 | end |
151 | end | 151 | end |
152 | end | 152 | end |
153 | 153 | ||
154 | attrdir (".") | 154 | attrdir (".") |
155 | </pre> | 155 | </pre> |
156 | 156 | ||
157 | 157 | ||
158 | <a name="contents"></a> | 158 | <a name="contents"></a> |
159 | <h2>Contents</h2> | 159 | <h2>Contents</h2> |
160 | <p> | 160 | <p> |
161 | <ul> | 161 | <ul> |
162 | <li> <a href="#introduction">Introduction</a> | 162 | <li> <a href="#introduction">Introduction</a> |
163 | <li> <a href="#reference">Reference</a> | 163 | <li> <a href="#reference">Reference</a> |
164 | <ul> | 164 | <ul> |
165 | <li> <a href="#chdir">chdir</a> | 165 | <li> <a href="#chdir">chdir</a> |
166 | <li> <a href="#currentdir">currentdir</a> | 166 | <li> <a href="#currentdir">currentdir</a> |
167 | <li> <a href="#dir">dir</a> | 167 | <li> <a href="#dir">dir</a> |
168 | <li> <a href="#lock">lock</a> | 168 | <li> <a href="#lock">lock</a> |
169 | <li> <a href="#mkdir">mkdir</a> | 169 | <li> <a href="#mkdir">mkdir</a> |
170 | <li> <a href="#unlock">unlock</a> | 170 | <li> <a href="#unlock">unlock</a> |
171 | </ul> | 171 | </ul> |
172 | <li> <a href="#examples">Examples</a> | 172 | <li> <a href="#examples">Examples</a> |
173 | </ul> | 173 | </ul> |
174 | </p> | 174 | </p> |
175 | 175 | ||
176 | 176 | ||
177 | <p> | 177 | <p> |
178 | <center><small> | 178 | <center><small> |
179 | <a href="index.html">home</a> · | 179 | <a href="index.html">home</a> · |
180 | <a href="#introduction">introduction</a> · | 180 | <a href="#introduction">introduction</a> · |
181 | <a href="#reference">reference</a> · | 181 | <a href="#reference">reference</a> · |
182 | <a href="#example">example</a> | 182 | <a href="#example">example</a> |
183 | </small></center> | 183 | </small></center> |
184 | <p> | 184 | <p> |
185 | 185 | ||
186 | <hr> | 186 | <hr> |
187 | <small> | 187 | <small> |
188 | $Id: manual.html,v 1.6 2004/11/05 10:37:29 tomas Exp $ | 188 | $Id: manual.html,v 1.7 2004/11/10 14:09:45 tuler Exp $ |
189 | </small> | 189 | </small> |
190 | 190 | ||
191 | </body> | 191 | </body> |
192 | </html> | 192 | </html> |