Skip to content

Commit 1e48796

Browse files
committed
update std
1 parent 5206bcd commit 1e48796

File tree

5 files changed

+24
-12
lines changed

5 files changed

+24
-12
lines changed

crates/emmylua_code_analysis/resources/std/debug.lua

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ function debug.gethook(thread) end
6363
---@field ntransfer integer
6464
---@field activelines table
6565

66+
---@alias debuglib.InfoWhat
67+
---|+"n" # `name` 和 `namewhat`
68+
---|+"S" # `source`,`short_src`,`linedefined`,`lalinedefined`,和 `what`
69+
---|+"l" # `currentline`
70+
---|+"t" # `istailcall`
71+
---|+"u" # `nups`、`nparams` 和 `isvararg`
72+
---|+"f" # `func`
73+
---|+"r" # `ftransfer` 和 `ntransfer`
74+
---|+"L" # `activelines`
75+
---| string
76+
6677
---
6778
--- Returns a table with information about a function. You can give the
6879
--- function directly, or you can give a number as the value of `f`,
@@ -83,10 +94,10 @@ function debug.gethook(thread) end
8394
--- with a name for the current function, if a reasonable name can be found,
8495
--- and the expression `debug.getinfo(print)` returns a table with all available
8596
--- information about the `print` function.
86-
---@overload fun(f: int|function, what?: string):debuglib.DebugInfo
97+
---@overload fun(f: int|function, what?: debuglib.InfoWhat):debuglib.DebugInfo
8798
---@param thread thread
88-
---@param f function
89-
---@param what? string
99+
---@param f integer|async fun(...):any...
100+
---@param what? debuglib.InfoWhat
90101
---@return debuglib.DebugInfo
91102
---@nodiscard
92103
function debug.getinfo(thread, f, what) end
@@ -146,10 +157,10 @@ function debug.getlocal(thread, lvl, index) end
146157
---
147158
--- Returns the metatable of the given `value` or **nil** if it does not have
148159
--- a metatable.
149-
---@param value table
160+
---@param object any
150161
---@return table?
151162
---@nodiscard
152-
function debug.getmetatable(value) end
163+
function debug.getmetatable(object) end
153164

154165
---
155166
--- Returns the registry table.

crates/emmylua_code_analysis/resources/std/global.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ function select(index, ...) end
371371
---
372372
--- This function returns `table`.
373373
---@param table table
374-
---@param metatable std.metatable|table
374+
---@param metatable? std.metatable|table
375375
---@return table
376376
function setmetatable(table, metatable) end
377377

crates/emmylua_code_analysis/resources/std/io.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function io.input(file) end
5555
---@return fun():any
5656
function io.lines(filename, ...) end
5757

58-
---@alias iolib.OpenMode "r" | "w" | "a" | "r+" | "w+" | "a+" | "rb" | "wb" | "ab" | "rb+" | "wb+" | "ab+"
58+
---@alias iolib.OpenMode "r" | "w" | "a" | "r+" | "w+" | "a+" | "rb" | "wb" | "ab" | "rb+" | "wb+" | "ab+" | "r+b" | "w+b" | "a+b"
5959
---
6060
--- This function opens a file, in the mode specified in the string `mode`. In
6161
--- case of success, it returns a new file handle. The `mode` string can be

crates/emmylua_code_analysis/resources/std/math.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function math.tointeger(x) end
194194
---
195195
--- Returns "`integer`" if `x` is an integer, "`float`" if it is a float, or
196196
--- **nil** if `x` is not a number.
197-
---@param x number
197+
---@param x any
198198
---@return 'integer'|'float'|'nil'
199199
function math.type(x) end
200200

crates/emmylua_code_analysis/resources/std/string.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,12 @@ function string.gmatch(s, pattern) end
190190
--- `local t = {name="lua", version="5.3"}`
191191
--- `x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)`
192192
--- > x="lua-5.3.tar.gz"
193-
---@param s string
194-
---@param pattern string
195-
---@param repl string|fun(param:string)
193+
---@param s string|number
194+
---@param pattern string|number
195+
---@param repl string|number|table|fun(param:string)
196196
---@param n? integer
197-
---@return string, integer
197+
---@return string
198+
---@return integer count
198199
function string.gsub(s, pattern, repl, n) end
199200

200201
---

0 commit comments

Comments
 (0)