summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/3rd/OpenResty/library/ngx.lua14
-rw-r--r--meta/template/basic.lua22
-rw-r--r--meta/template/debug.lua10
-rw-r--r--meta/template/io.lua4
-rw-r--r--meta/template/os.lua6
-rw-r--r--meta/template/string.lua2
-rw-r--r--meta/template/table.lua5
-rw-r--r--meta/template/utf8.lua4
8 files changed, 35 insertions, 32 deletions
diff --git a/meta/3rd/OpenResty/library/ngx.lua b/meta/3rd/OpenResty/library/ngx.lua
index f8f5eabf..b85593bf 100644
--- a/meta/3rd/OpenResty/library/ngx.lua
+++ b/meta/3rd/OpenResty/library/ngx.lua
@@ -2134,7 +2134,7 @@ function ngx.req.get_post_args(max_args) end
---
--- Removing the `max_args` cap is strongly discouraged.
---
----@param max_args number
+---@param max_args? number
---@return table args
---@return string|'"truncated"' error
function ngx.req.get_uri_args(max_args) end
@@ -2228,8 +2228,8 @@ function ngx.req.get_uri_args(max_args) end
--- in "\x00foo" (maybe you want to set the 'binary' argument?)
---
---@param uri string
----@param jump boolean
----@param binary boolean
+---@param jump? boolean
+---@param binary? boolean
function ngx.req.set_uri(uri, jump, binary) end
--- Append new data chunk specified by the `data_chunk` argument onto the existing request body created by the `ngx.req.init_body` call.
@@ -2438,8 +2438,8 @@ function ngx.req.clear_header(header_name) end
---
--- The `__index` metamethod will not be added when the `raw` argument is set to `true`.
---
----@param max_headers number
----@param raw boolean
+---@param max_headers? number
+---@param raw? boolean
---@return table<string, string|string[]> headers
---@return string|'"truncated"' error
function ngx.req.get_headers(max_headers, raw) end
@@ -4211,8 +4211,8 @@ ngx.resp = {}
---
--- Note that a maximum of 100 response headers are parsed by default (including those with the same name) and that additional response headers are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
---
----@param max_headers number
----@param raw boolean
+---@param max_headers? number
+---@param raw? boolean
---@return table<string, string|string[]>
---@return string|'"truncated"' error
function ngx.resp.get_headers(max_headers, raw) end
diff --git a/meta/template/basic.lua b/meta/template/basic.lua
index aed3085e..b4913cc2 100644
--- a/meta/template/basic.lua
+++ b/meta/template/basic.lua
@@ -7,7 +7,7 @@ arg = {}
---#DES 'assert'
---@generic T
---@param v T
----@param message any
+---@param message? any
---@return T
function assert(v, message) end
@@ -83,8 +83,8 @@ function ipairs(t) end
---#DES 'load<5.1'
---@param func function
---@param chunkname? string
----@return function
----@return string error_message
+---@return function?
+---@return string? error_message
---@nodiscard
function load(func, chunkname) end
---#else
@@ -93,8 +93,8 @@ function load(func, chunkname) end
---@param chunkname? string
---@param mode? loadmode
---@param env? table
----@return function
----@return string error_message
+---@return function?
+---@return string? error_message
---@nodiscard
function load(chunk, chunkname, mode, env) end
---#end
@@ -102,8 +102,8 @@ function load(chunk, chunkname, mode, env) end
---#if VERSION <= 5.1 and not JIT then
---#DES 'loadfile'
---@param filename? string
----@return function
----@return string error_message
+---@return function?
+---@return string? error_message
---@nodiscard
function loadfile(filename) end
---#else
@@ -111,8 +111,8 @@ function loadfile(filename) end
---@param filename? string
---@param mode? loadmode
---@param env? table
----@return function
----@return string error_message
+---@return function?
+---@return string? error_message
---@nodiscard
function loadfile(filename, mode, env) end
---#end
@@ -121,8 +121,8 @@ function loadfile(filename, mode, env) end
---#DES 'loadstring'
---@param text string
---@param chunkname? string
----@return function
----@return string error_message
+---@return function?
+---@return string? error_message
---@nodiscard
function loadstring(text, chunkname) end
diff --git a/meta/template/debug.lua b/meta/template/debug.lua
index 6e74e1f6..f62aca6e 100644
--- a/meta/template/debug.lua
+++ b/meta/template/debug.lua
@@ -112,8 +112,8 @@ function debug.getupvalue(f, up) end
---#if VERSION >= 5.4 then
---#DES 'debug.getuservalue>5.4'
----@param u userdata
----@param n integer
+---@param u userdata
+---@param n? integer
---@return any
---@return boolean
---@nodiscard
@@ -146,7 +146,9 @@ function debug.setfenv(object, env) end
---|+'"l"' # ---#DESTAIL 'hookmask.l'
---#DES 'debug.sethook'
----@overload fun(hook: function, mask: hookmask, count?: integer)
+---@overload fun(hook: async fun(), mask: hookmask, count?: integer)
+---@overload fun(thread: thread)
+---@overload fun()
---@param thread thread
---@param hook async fun()
---@param mask hookmask
@@ -180,7 +182,7 @@ function debug.setupvalue(f, up, value) end
---#DES 'debug.setuservalue>5.4'
---@param udata userdata
---@param value any
----@param n integer
+---@param n? integer
---@return userdata udata
function debug.setuservalue(udata, value, n) end
---#elseif VERSION >= 5.2 or JIT then
diff --git a/meta/template/io.lua b/meta/template/io.lua
index b2846878..b1fe5a9e 100644
--- a/meta/template/io.lua
+++ b/meta/template/io.lua
@@ -47,7 +47,7 @@ function io.lines(filename, ...) end
---#DES 'io.open'
---@param filename string
----@param mode openmode
+---@param mode? openmode
---@return file*?
---@return string? errmsg
---@nodiscard
@@ -157,7 +157,7 @@ function file:seek(whence, offset) end
---#DES 'file:setvbuf'
---@param mode vbuf
----@param size integer
+---@param size? integer
function file:setvbuf(mode, size) end
---#DES 'file:write'
diff --git a/meta/template/os.lua b/meta/template/os.lua
index af9b3278..c6af18cd 100644
--- a/meta/template/os.lua
+++ b/meta/template/os.lua
@@ -45,11 +45,11 @@ function os.difftime(t2, t1) end
---#DES 'os.execute'
---#if VERSION <= 5.1 then
----@param command string
+---@param command? string
---@return integer code
function os.execute(command) end
---#else
----@param command string
+---@param command? string
---@return boolean? suc
---@return exitcode? exitcode
---@return integer? code
@@ -69,7 +69,7 @@ function os.exit(code, close) end
---#DES 'os.getenv'
---@param varname string
----@return string
+---@return string?
---@nodiscard
function os.getenv(varname) end
diff --git a/meta/template/string.lua b/meta/template/string.lua
index 0e0d0537..a115648e 100644
--- a/meta/template/string.lua
+++ b/meta/template/string.lua
@@ -65,7 +65,7 @@ function string.gmatch(s, pattern, init) end
---@param s string
---@param pattern string
---@param repl string|table|function
----@param n integer
+---@param n? integer
---@return string
---@return integer count
---@nodiscard
diff --git a/meta/template/table.lua b/meta/template/table.lua
index 21c8b619..a7fe68d2 100644
--- a/meta/template/table.lua
+++ b/meta/template/table.lua
@@ -50,8 +50,9 @@ function table.pack(...) end
function table.remove(list, pos) end
---#DES 'table.sort'
----@param list table
----@param comp fun(a: any, b: any):boolean
+---@generic T
+---@param list T[]
+---@param comp? fun(a: T, b: T):boolean
function table.sort(list, comp) end
---@version >5.2, JIT
diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua
index bd474710..a00a3238 100644
--- a/meta/template/utf8.lua
+++ b/meta/template/utf8.lua
@@ -18,12 +18,12 @@ function utf8.char(code, ...) end
---#DES 'utf8.codes'
---#if VERSION <= 5.3 then
---@param s string
----@return fun():integer, integer
+---@return fun(s: string, p: integer):integer, integer
function utf8.codes(s) end
---#else
---@param s string
---@param lax? boolean
----@return fun():integer, integer
+---@return fun(s: string, p: integer):integer, integer
function utf8.codes(s, lax) end
---#end