summaryrefslogtreecommitdiff
path: root/meta/template/os.lua
blob: c491ecba95935c5c9c82f8d52d0eb4ab66857dae (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---@meta os

---#DES 'os'
---@class oslib
os = {}

---#DES 'os.clock'
---@return number
---@nodiscard
function os.clock() end

---@class osdate
---#DES 'osdate.year'
---@field year  integer|string
---#DES 'osdate.month'
---@field month integer|string
---#DES 'osdate.day'
---@field day   integer|string
---#DES 'osdate.hour'
---@field hour  integer|string
---#DES 'osdate.min'
---@field min   integer|string
---#DES 'osdate.sec'
---@field sec   integer|string
---#DES 'osdate.wday'
---@field wday  integer|string
---#DES 'osdate.yday'
---@field yday  integer|string
---#DES 'osdate.isdst'
---@field isdst boolean

---#DES 'os.date'
---@param format? string
---@param time?   integer
---@return string|osdate
---@nodiscard
function os.date(format, time) end

---#DES 'os.difftime'
---@param t2 integer
---@param t1 integer
---@return integer
---@nodiscard
function os.difftime(t2, t1) end

---#DES 'os.execute'
---#if VERSION <= 5.1 and not JIT then
---@param command? string
---@return integer code
function os.execute(command) end
---#else
---@param command? string
---@return boolean?  suc
---@return exitcode? exitcode
---@return integer?  code
function os.execute(command) end
---#end

---#if VERSION <= 5.1 and not JIT then
---#DES 'os.exit<5.1'
---@param code? integer
function os.exit(code, close) end
---#else
---#DES 'os.exit>5.2'
---@param code?  boolean|integer
---@param close? boolean
function os.exit(code, close) end
---#end

---#DES 'os.getenv'
---@param varname string
---@return string?
---@nodiscard
function os.getenv(varname) end

---#DES 'os.remove'
---@param filename string
---@return boolean suc
---@return string? errmsg
function os.remove(filename) end

---#DES 'os.rename'
---@param oldname string
---@param newname string
---@return boolean suc
---@return string? errmsg
function os.rename(oldname, newname) end

---@alias localecategory
---|>"all"
---| "collate"
---| "ctype"
---| "monetary"
---| "numeric"
---| "time"

---#DES 'os.setlocale'
---@param locale    string|nil
---@param category? localecategory
---@return string localecategory
function os.setlocale(locale, category) end

---@class osdateparam
---#DES 'osdate.year'
---@field year  integer|string
---#DES 'osdate.month'
---@field month integer|string
---#DES 'osdate.day'
---@field day   integer|string
---#DES 'osdate.hour'
---@field hour  (integer|string)?
---#DES 'osdate.min'
---@field min   (integer|string)?
---#DES 'osdate.sec'
---@field sec   (integer|string)?
---#DES 'osdate.wday'
---@field wday  integer|string
---#DES 'osdate.yday'
---@field yday  integer|string
---#DES 'osdate.isdst'
---@field isdst boolean?

---#DES 'os.time'
---@param date? osdateparam
---@return integer
---@nodiscard
function os.time(date) end

---#DES 'os.tmpname'
---@return string
---@nodiscard
function os.tmpname() end

return os