aboutsummaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2025-03-04 01:42:17 -0300
committerHisham Muhammad <hisham@gobolinux.org>2025-03-10 10:51:04 -0300
commit2c19375164920f7d85fa9f138cd7e52a87f12b58 (patch)
tree45c07397408052d4f9efad8841770a3173a532e1 /types
parente8f1267ee3d091145b281b86548a31c89ad27d74 (diff)
downloadluarocks-2c19375164920f7d85fa9f138cd7e52a87f12b58.tar.gz
luarocks-2c19375164920f7d85fa9f138cd7e52a87f12b58.tar.bz2
luarocks-2c19375164920f7d85fa9f138cd7e52a87f12b58.zip
lfs: improved type definition from teal-types
Diffstat (limited to 'types')
-rw-r--r--types/lfs.d.tl85
1 files changed, 56 insertions, 29 deletions
diff --git a/types/lfs.d.tl b/types/lfs.d.tl
index 12535ca4..ff0ad1ed 100644
--- a/types/lfs.d.tl
+++ b/types/lfs.d.tl
@@ -12,20 +12,43 @@ local record lfs
12 end 12 end
13 13
14 record Attributes 14 record Attributes
15 dev: number 15 dev: integer
16 ino: number 16 ino: integer
17 mode: FileMode 17 mode: FileMode
18 nlink: number 18 nlink: integer
19 uid: number 19 uid: integer
20 gid: number 20 gid: integer
21 rdev: number 21 rdev: integer
22 access: number 22 access: integer
23 modification: number 23 modification: integer
24 change: number 24 change: integer
25 size: number 25 size: integer
26 permissions: string 26 permissions: string
27 blocks: number 27 blocks: integer
28 blksize: number 28 blksize: integer
29 end
30
31 enum AttributeSelInt
32 "dev"
33 "ino"
34 "nlink"
35 "uid"
36 "gid"
37 "rdev"
38 "access"
39 "modification"
40 "change"
41 "size"
42 "blocks"
43 "blksize"
44 end
45
46 enum AttributeSelStr
47 "permissions"
48 end
49
50 enum AttributeSelFM
51 "mode"
29 end 52 end
30 53
31 enum OpenFileMode 54 enum OpenFileMode
@@ -39,43 +62,47 @@ local record lfs
39 end 62 end
40 63
41 record Lock 64 record Lock
42 free: function() 65 free: function(self)
66 end
67
68 record DirObj
69 next: function(self): string
70 close: function(self)
43 end 71 end
44 72
45 dir: function(string): function(): string 73 dir: function(string): function(DirObj): (string), DirObj, nil, DirObj
46 74
47 chdir: function(string): boolean, string 75 chdir: function(string): boolean, string
48 76
49 lock_dir: function(string, number): Lock, string 77 lock_dir: function(string, ? integer): Lock, string
50 78
51 -- returns number on success, really!? this should be fixed in the lfs library 79 link: function(string, string, ? boolean): boolean, string
52 link: function(string, string, boolean): number, string
53 80
54 mkdir: function(string): boolean, string 81 mkdir: function(string): boolean, string, integer
55 82
56 rmdir: function(string): boolean, string 83 rmdir: function(string): boolean, string, integer
57 84
58 setmode: function(string, OpenFileMode): boolean, string 85 setmode: function(string, OpenFileMode): boolean, string
59 86
60 currentdir: function(): string 87 currentdir: function(): string, string
61 88
62 attributes: function(string): Attributes 89 attributes: function(string): Attributes
63 attributes: function(string, string): string 90 attributes: function(string, AttributeSelStr): string
64 attributes: function(string, string): number 91 attributes: function(string, AttributeSelInt): integer
65 attributes: function(string, string): FileMode 92 attributes: function(string, AttributeSelFM): FileMode
66 attributes: function(string, Attributes): Attributes 93 attributes: function(string, Attributes): Attributes
67 94
68 symlinkattributes: function(string): Attributes 95 symlinkattributes: function(string): Attributes
69 symlinkattributes: function(string, string): string 96 symlinkattributes: function(string, AttributeSelStr): string
70 symlinkattributes: function(string, string): number 97 symlinkattributes: function(string, AttributeSelInt): integer
71 symlinkattributes: function(string, string): FileMode 98 symlinkattributes: function(string, AttributeSelFM): FileMode
72 symlinkattributes: function(string, Attributes): Attributes 99 symlinkattributes: function(string, Attributes): Attributes
73 100
74 touch: function(string, number, number): boolean, string 101 touch: function(string, ? integer, ? integer): boolean, string
75 102
76 -- TODO: FILE needs to be renamed to io.FILE in tl itself 103 -- TODO: FILE needs to be renamed to io.FILE in tl itself
77 lock: function(FILE, LockMode, number, number): boolean, string 104 lock: function(FILE, LockMode, ? integer, ? integer): boolean, string
78 unlock: function(FILE, number, number): boolean, string 105 unlock: function(FILE, ? integer, ? integer): boolean, string
79 106
80end 107end
81 108