mirror of
https://github.com/lunarmodules/luafilesystem.git
synced 2026-07-22 02:53:06 +00:00
Acrescimo de exemplo.
Acrescimo do logo.
This commit is contained in:
BIN
doc/us/luafilesystem.png
Normal file
BIN
doc/us/luafilesystem.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
@@ -110,6 +110,30 @@ LuaFileSystem offers the following functions:
|
||||
<a name="example"></a>
|
||||
<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>
|
||||
<h2>Contents</h2>
|
||||
@@ -141,7 +165,7 @@ LuaFileSystem offers the following functions:
|
||||
|
||||
<hr>
|
||||
<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>
|
||||
|
||||
</body>
|
||||
|
||||
10
teste.lua
10
teste.lua
@@ -1,24 +1,24 @@
|
||||
#!/usr/local/bin/lua -i
|
||||
|
||||
require"luafilesystem"
|
||||
require"lfs"
|
||||
|
||||
print(luafilesystem.version)
|
||||
print(lfs.version)
|
||||
|
||||
function p ()
|
||||
local fh = assert (io.open ("teste", 'r'))
|
||||
assert (luafilesystem.lock (fh, 'r'))
|
||||
assert (lfs.lock (fh, 'r'))
|
||||
print (fh:read"*a")
|
||||
fh:close ()
|
||||
end
|
||||
|
||||
function wr ()
|
||||
fh = assert (io.open ("teste", 'w'))
|
||||
assert (luafilesystem.lock (fh, 'w'))
|
||||
assert (lfs.lock (fh, 'w'))
|
||||
end
|
||||
|
||||
function op ()
|
||||
fh = assert (io.open ("teste", 'r'))
|
||||
assert (luafilesystem.lock (fh, 'r'))
|
||||
assert (lfs.lock (fh, 'r'))
|
||||
end
|
||||
|
||||
function fw (x)
|
||||
|
||||
Reference in New Issue
Block a user