Acrescimo de exemplo.

Acrescimo do logo.
This commit is contained in:
tomas
2004-10-29 16:15:59 +00:00
parent 40db9dba61
commit f66af01eec
3 changed files with 30 additions and 6 deletions

BIN
doc/us/luafilesystem.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -110,6 +110,30 @@ LuaFileSystem offers the following functions:
<a name="example"></a> <a name="example"></a>
<h2>Example</h2> <h2>Example</h2>
<pre>
require"lfs"
function attrdir (path)
for file in lfs.dir(path) do
if file ~= "." and file ~= ".." then
local f = path..'/'..file
print ("\t "..f)
local attr = lfs.attributes (f)
assert (type(attr) == "table")
if attr.mode == "directory" then
attrdir (f)
else
for name, value in pairs(attr) do
print (name, value)
end
end
end
end
end
attrdir (".")
</pre>
<a name="contents"></a> <a name="contents"></a>
<h2>Contents</h2> <h2>Contents</h2>
@@ -141,7 +165,7 @@ LuaFileSystem offers the following functions:
<hr> <hr>
<small> <small>
$Id: manual.html,v 1.3 2004/10/27 18:01:42 tomas Exp $ $Id: manual.html,v 1.4 2004/10/29 16:15:59 tomas Exp $
</small> </small>
</body> </body>

View File

@@ -1,24 +1,24 @@
#!/usr/local/bin/lua -i #!/usr/local/bin/lua -i
require"luafilesystem" require"lfs"
print(luafilesystem.version) print(lfs.version)
function p () function p ()
local fh = assert (io.open ("teste", 'r')) local fh = assert (io.open ("teste", 'r'))
assert (luafilesystem.lock (fh, 'r')) assert (lfs.lock (fh, 'r'))
print (fh:read"*a") print (fh:read"*a")
fh:close () fh:close ()
end end
function wr () function wr ()
fh = assert (io.open ("teste", 'w')) fh = assert (io.open ("teste", 'w'))
assert (luafilesystem.lock (fh, 'w')) assert (lfs.lock (fh, 'w'))
end end
function op () function op ()
fh = assert (io.open ("teste", 'r')) fh = assert (io.open ("teste", 'r'))
assert (luafilesystem.lock (fh, 'r')) assert (lfs.lock (fh, 'r'))
end end
function fw (x) function fw (x)