summaryrefslogtreecommitdiff
path: root/meta/template/basic.lua
blob: ad12e980807089d901f6f0719a98b9a0e05bcebf (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
---@type table
arg = {}

---@generic ANY
---@param v ANY
---@param message any
---@return ANY
function assert(v, message) end

---@alias cgopt54
---| '"stop"'
---| '"restart"'
---| '"count"'
---| '"step"'
---| '"incremental"'
---| '"generational"'
---| '"isrunning"'

---@param opt cgopt54?
---@return any
function collectgarbage(opt, ...) end

---@param filename string?
---@return any
function dofile(filename) end

---@param message any
---@param level integer?
function error(message, level) end

---@class _G
_G = {}

---#if VERSION >= 5.2 then
---@deprecated
---#end
---@param f function?
---@return table
function getfenv(f) end

---@param object any
---@return table metatable
function getmetatable(object) end

---@generic TABLE: table
---@param t TABLE
---@return fun(t: table, i: integer?):integer, any iterator
---@return TABLE t
---@return integer i
function ipairs(t) end

---@alias loadmode
---| '"b"''
---| '"t"'
---|>'"bt"'

---@param chunk string|function
---@param chunkname string?
---@param mode loadmode?
---@param env table?
---@return function
---@return string error_message
function load(chunk, chunkname, mode, env) end

---@param filename string?
---@param mode loadmode?
---@param env table?
---@return function
---@return string error_message
function loadfile(filename, mode, env) end

---#if VERSION >= 5.2 then
---@deprecated
---#end
---@param text string
---@param chunkname string?
---@return function
---@return string error_message
function loadstring(text, chunkname) end

---#if VERSION >= 5.2 then
---@deprecated
---#end
---@param name string
function module(name, ...) end

---@param table table
---@param index any?
---@return any key
---@return any value
function next(table, index) end

---@generic TABLE: table
---@param t TABLE
---@return function next
---@return TABLE
---@return nil
function pairs(t)
    return next
end

---@param f function
---@param arg1 any?
---@return boolean success
---@return any result
---@return ...
function pcall(f, arg1, ...) end

function print(...) end

---@param v1 any
---@param v2 any
---@return boolean
function rawequal(v1, v2) end

---@param table table
---@param index any
---@return any
function rawget(table, index) end

---@param v table|string
---@return integer len
function rawlen(v) end

---@generic TABLE table
---@param table TABLE
---@param index any
---@param value any
---@return TABLE
function rawset(table, index, value) end

---@param index integer|'"#"'
---@return any
function select(index, ...) end

---#if VERSION >= 5.2 then
---@deprecated
---#end
---@param f function|integer
---@param table table
---@return function
function setfenv(f, table) end

---@generic TABLE: table
---@param table TABLE
---@param metatable table
---@return TABLE
function setmetatable(table, metatable) end

---@param e string|number
---@param base integer?
---@return number|nil
function tonumber(e, base) end

---@param v any
---@return string
function tostring(v) end

---@alias type
---| '"nil"'
---| '"number"'
---| '"string"'
---| '"boolean"'
---| '"table"'
---| '"function"'
---| '"thread"'
---| '"userdata"'

---@param v any
---@return type type
function type(v) end

---#if VERSION == 5.1 then
_VERSION = 'Lua 5.1'
---#elseif VERSION == 5.2 then
_VERSION = 'Lua 5.2'
---#elseif VERSION == 5.3 then
_VERSION = 'Lua 5.3'
---#elseif VERSION == 5.4 then
_VERSION = 'Lua 5.4'
---#end

---@param message string
function warn(message, ...) end

---@param f function
---@param msgh function
---@param arg1 any?
---@return boolean success
---@return any result
---@return ...
function xpcall(f, msgh, arg1, ...) end

---@param modname string
---@return any
---@return any loaderdata
function require(modname) end

---#if VERSION >= 5.2 then
---@deprecated
---#end
---@param list table
---@param i integer?
---@param j integer?
function unpack(list, i, j) end