Skip to content

Commit 32307b4

Browse files
authored
Merge pull request #533 from tinyleolin/docs/improve-api-versioning
improve api versioning
2 parents ede5be6 + 5cbe87a commit 32307b4

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

crates/emmylua_code_analysis/resources/std/global.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ function assert(v, ...) end
3030
---| "restart" # restarts automatic execution of the garbage collector.
3131
---| "count" # returns the total memory in use by Lua in Kbytes. The value has a fractional part, so that it multiplied by 1024 gives the exact number of bytes in use by Lua (except for overflows).
3232
---| "step" # performs a garbage-collection step. The step "size" is controlled by `arg`. With a zero value, the collector will perform one basic (indivisible) step. For non-zero values, the collector will perform as if Lua had allocated that amount of memory (in KBytes). Returns true if the step finished a collection cycle.
33-
---| "setpause" # sets `arg` as the new value for the *pause* of the collector (see §2.5). Returns the previous value for *pause`.
33+
---| "setpause" # sets `arg` as the new value for the *pause* of the collector (see §2.5). Returns the previous value for *pause*.
34+
---| "setstepmul" # sets `arg` as the new value for the *step multiplier* of the collector (see §2.5). Returns the previous value for *step*.
3435
---| "incremental" # Change the collector mode to incremental. This option can be followed by three numbers: the garbage-collector pause, the step multiplier, and the step size.
3536
---| "generational" # Change the collector mode to generational. This option can be followed by two numbers: the garbage-collector minor multiplier and the major multiplier.
3637
---| "isrunning" # returns a boolean that tells whether the collector is running (i.e., not stopped).
@@ -274,6 +275,8 @@ function rawequal(v1, v2) end
274275
---@return std.RawGet<T, K>
275276
function rawget(table, index) end
276277

278+
---@version >5.2
279+
---
277280
--- Returns the length of the object `v`, which must be a table or a string, without
278281
--- invoking any metamethod. Returns an integer number.
279282
---@param v string|table

crates/emmylua_code_analysis/resources/std/math.lua

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function math.atan(y, x) end
5151
--- Returns the smallest integer larger than or equal to `x`.
5252
---@param x number
5353
---@return integer
54-
function math.ceil(x) return 0 end
54+
function math.ceil(x) end
5555

5656
---
5757
--- Returns the cosine of `x` (assumed to be in radians).
@@ -108,6 +108,7 @@ function math.log(x, base) end
108108
---@return number
109109
function math.max(x, ...) end
110110

111+
---@version >5.3
111112
---
112113
--- An integer with the maximum value for an integer.
113114
---@type integer
@@ -122,6 +123,7 @@ math.maxinteger = nil
122123
---@return number
123124
function math.min(x, ...) end
124125

126+
---@version >5.3
125127
---
126128
--- An integer with the minimum value for an integer.
127129
---@type integer
@@ -208,15 +210,15 @@ function math.type(x) end
208210
---@return boolean
209211
function math.ult(m, n) end
210212

211-
---@version 5.1, JIT
213+
---@version 5.1, 5.2, JIT
212214
---
213215
--- Returns the value of `x` raised to the power `y`. (x^y)
214216
---@param x number The base
215217
---@param y number The exponent
216218
---@return number
217219
function math.pow(x, y) end
218220

219-
---@version 5.1, JIT
221+
---@version 5.1, 5.2, JIT
220222
---
221223
--- Returns the arc tangent of `y/x` (in radians), but uses the signs of both
222224
--- parameters to find the quadrant of the result. (It also handles correctly
@@ -235,4 +237,41 @@ function math.atan2(y, x) end
235237
---@return number
236238
function math.log10(x) end
237239

240+
---@version 5.1, 5.2, JIT
241+
---
242+
--- Returns the hyperbolic cosine of `x`.
243+
---@param x number
244+
---@return number
245+
function math.cosh(x) end
246+
247+
---@version 5.1, 5.2, JIT
248+
---
249+
--- Returns the hyperbolic sine of `x`.
250+
---@param x number
251+
---@return number
252+
function math.sinh(x) end
253+
254+
---@version 5.1, 5.2, JIT
255+
---
256+
--- Returns the hyperbolic tangent of `x`.
257+
---@param x number
258+
---@return number
259+
function math.tanh(x) end
260+
261+
---@version 5.1, 5.2, JIT
262+
---
263+
--- Returns `m` and `e` such that *x = m2^e*, `e` is an integer and the absolute
264+
--- value of `m` is in the range *[0.5, 1)* (or zero when `x` is zero).
265+
---@param x number
266+
---@return number, integer
267+
function math.frexp(x) end
268+
269+
---@version 5.1, 5.2, JIT
270+
---
271+
--- Returns *m2e* (`e` should be an integer).
272+
---@param m number
273+
---@param e integer
274+
---@return number
275+
function math.ldexp(m, e) end
276+
238277
return math

crates/emmylua_code_analysis/resources/std/table.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function table.concat(list, sep, i, j) end
4141
---@return integer
4242
function table.insert(list, pos, value) end
4343

44+
---@version > 5.3
4445
---
4546
--- Moves elements from table a1 to table `a2`, performing the equivalent to
4647
--- the following multiple assignment: `a2[t]`,`··· = a1[f]`,`···,a1[e]`. The

0 commit comments

Comments
 (0)