File: lfs.luadoc

package info (click to toggle)
lua-doc 3.0.1%2Bgitdb9e868-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 408 kB
  • ctags: 122
  • sloc: makefile: 51
file content (79 lines) | stat: -rw-r--r-- 4,048 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

--- LuaFileSystem is a Lua library developed to complement the set of functions 
-- related to file systems offered by the standard Lua distribution.
-- LuaFileSystem offers a portable way to access the underlying directory 
-- structure and file attributes.

module "lfs"

--- Returns a table with the file attributes corresponding to
--    <code>filepath</code> (or <code>nil</code> followed by an error message
--    in case of error).
--    If the second optional argument is given, then only the value of the
--    named attribute is returned (this use is equivalent to
--    <code>lfs.attributes(filepath).aname</code>, but the table is not created
--    and only one attribute is retrieved from the O.S.).
--    The attributes are described as follows;
--    attribute <code>mode</code> is a string, all the others are numbers,
--    and the time related attributes use the same time reference of
--    <a href="http://www.lua.org/manual/5.0/manual.html#5.7"><code>os.time</code></a>.
function attributes (filepath, aname)

--- Changes the current working directory to the given
--    <code>path</code>.<br />
--    Returns <code>true</code> in case of success or <code>nil</code> plus an
--    error string.
function chdir (path)

--- Returns a string with the current working directory or <code>nil</code>
--  plus an error string.
function currentdir ()

---    Lua iterator over the entries of a given directory.
--    Each time the iterator is called it returns a string with an entry of the
--    directory; <code>nil</code> is returned when there is no more entries.
--    Raises an error if <code>path</code> is not a directory.
function dir (path)

--- 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
--    <code>r</code> (for a read/shared lock) or <code>w</code> (for a
--    write/exclusive lock). The optional arguments <code>start</code>
--    and <code>length</code> can be used to specify a starting point and
--    its length; both should be numbers.<br />
--    Returns <code>true</code> if the operation was successful; in
--    case of error, it returns <code>nil</code> plus an error string.
function lock (filehandle, mode, start, length)

--- Creates a new directory. The argument is the name of the new
--    directory.<br />
--    Returns <code>true</code> if the operation was successful;
--    in case of error, it returns <code>nil</code> plus an error string.
function mkdir (dirname)

--- Removes an existing directory. The argument is the name of the directory.<br />
--    Returns <code>true</code> if the operation was successful;
--    in case of error, it returns <code>nil</code> plus an error string.
function rmdir (dirname)

--- Set access and modification times of a file. This function is
--    a bind to <code>utime</code> function. The first argument is the
--    filename, the second argument (<code>atime</code>) is the access time,
--    and the third argument (<code>mtime</code>) is the modification time.
--    Both times are provided in seconds (which should be generated with
--    Lua standard function <code>os.date</code>).
--    If the modification time is omitted, the access time provided is used;
--    if both times are omitted, the current time is used.<br />
--    Returns <code>true</code> if the operation was successful;
--    in case of error, it returns <code>nil</code> plus an error string.
function touch (filepath, atime, mtime)

--- 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
--    argument. The optional arguments <code>start</code> and
--    <code>length</code> can be used to specify a starting point and its
--    length; both should be numbers.<br />
--    Returns <code>true</code> if the operation was successful;
--    in case of error, it returns <code>nil</code> plus an error string.
function unlock (filehandle, start, length)