summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/template/debug.lua96
-rw-r--r--meta/template/file.lua38
-rw-r--r--meta/template/io.lua47
3 files changed, 135 insertions, 46 deletions
diff --git a/meta/template/debug.lua b/meta/template/debug.lua
index 0f360eb5..6c010c0f 100644
--- a/meta/template/debug.lua
+++ b/meta/template/debug.lua
@@ -1,5 +1,6 @@
---@meta
+---#DES 'debug'
---@class debug*
debug = {}
@@ -14,19 +15,27 @@ debug = {}
---@field currentline integer
---@field istailcall boolean
---@field nups integer
+---#if VERSION >= 5.2 then
---@field nparams integer
---@field isvararg boolean
+---#endif
---@field func function
+---#if VERSION >= 5.4 then
---@field ftransfer integer
---@field ntransfer integer
+---#endif
---@field activelines table
+---#DES 'debug.debug'
function debug.debug() end
+---@version 5.1
+---#DES 'debug.getfenv'
---@param o any
---@return table
function debug.getfenv(o) end
+---#DES 'debug.gethook'
---@param co? thread
---@return function hook
---@return string mask
@@ -34,15 +43,22 @@ function debug.getfenv(o) end
function debug.gethook(co) end
---@alias infowhat string
----|+'"n"' # `name` 和 `namewhat`
----|+'"S"' # `source`,`short_src`,`linedefined`,`lalinedefined`,和 `what`
----|+'"l"' # `currentline`
----|+'"t"' # `istailcall`
----|+'"u"' # `nups`,`nparams` 和 `isvararg`
----|+'"f"' # `func`
----|+'"r"' # `ftransfer` 和 `ntransfer`
----|+'"L"' # `activelines`
-
+---|+'"n"' # ---#DESENUM 'infowhat.n'
+---|+'"S"' # ---#DESENUM 'infowhat.S'
+---|+'"l"' # ---#DESENUM 'infowhat.l'
+---|+'"t"' # ---#DESENUM 'infowhat.t'
+---#if VERSION <= 5.1 then
+---|+'"u<5.1"' # ---#DESENUM 'infowhat.u<5.1'
+---#else
+---|+'"u>5.2"' # ---#DESENUM 'infowhat.u>5.2'
+---#end
+---|+'"f"' # ---#DESENUM 'infowhat.f'
+---#if VERSION >= 5.4 then
+---|+'"r"' # ---#DESENUM 'infowhat.r'
+---#endif
+---|+'"L"' # ---#DESENUM 'infowhat.L'
+
+---#DES 'debug.getinfo'
---@overload fun(f: integer|function, what?: infowhat):debuginfo
---@param thread thread
---@param f integer|function
@@ -50,38 +66,62 @@ function debug.gethook(co) end
---@return debuginfo
function debug.getinfo(thread, f, what) end
+---#DES 'debug.getlocal<5.1'
+---@overload fun(level: integer, index: integer):string, any
+---@param thread thread
+---@param level integer
+---@param index integer
+---@return string name
+---@return any value
+function debug.getlocal(thread, level, index) end
+
+---#DES 'debug.getlocal>5.2'
---@overload fun(f: integer|function, index: integer):string, any
----@param thread thread
----@param f integer|function
----@param index integer
+---@param thread thread
+---@param f integer|function
+---@param index integer
---@return string name
----@return any value
+---@return any value
function debug.getlocal(thread, f, index) end
+---#DES 'debug.getmetatable'
---@param object any
---@return table metatable
function debug.getmetatable(object) end
+---#DES 'debug.getregistry'
---@return table
function debug.getregistry() end
----@param f integer|function
+---#DES 'debug.getupvalue'
+---@param f function
---@param up integer
---@return string name
----@return any value
+---@return any value
function debug.getupvalue(f, up) end
+---#if VERSION >= 5.4 then
+---#DES 'debug.getuservalue>5.4'
---@param u userdata
---@param n integer
---@return any
---@return boolean
function debug.getuservalue(u, n) end
+---#else
+---#DES 'debug.getuservalue<5.3'
+---@param u userdata
+---@return any
+function debug.getuservalue(u) end
+---#endif
+---#DES 'debug.setcstacklimit'
---@deprecated
---@param limit integer
---@return integer|boolean
function debug.setcstacklimit(limit) end
+---#DES 'debug.setfenv'
+---@version 5.1
---@generic T
---@param object T
---@param env table
@@ -89,10 +129,11 @@ function debug.setcstacklimit(limit) end
function debug.setfenv(object, env) end
---@alias hookmask string
----|+'"c"'
----|+'"r"'
----|+'"l"'
+---|+'"c"' # ---#DESENUM 'hookmask.c'
+---|+'"r"' # ---#DESENUM 'hookmask.r'
+---|+'"l"' # ---#DESENUM 'hookmask.l'
+---#DES 'debug.sethook'
---@overload fun(hook: function, mask: hookmask, count?: integer)
---@param thread thread
---@param hook function
@@ -100,6 +141,7 @@ function debug.setfenv(object, env) end
---@param count? integer
function debug.sethook(thread, hook, mask, count) end
+---#DES 'debug.setlocal'
---@overload fun(level: integer, index: integer, value: any):string
---@param thread thread
---@param level integer
@@ -108,35 +150,51 @@ function debug.sethook(thread, hook, mask, count) end
---@return string name
function debug.setlocal(thread, level, index, value) end
+---#DES 'debug.setmetatable'
---@generic T
---@param value T
---@param meta table
---@return T value
function debug.setmetatable(value, meta) end
+---#DES 'debug.setupvalue'
---@param f function
---@param up integer
---@param value any
---@return string name
function debug.setupvalue(f, up, value) end
+---#if VERSION >= 5.4 then
+---#DES 'debug.setuservalue>5.4'
---@param udata userdata
---@param value any
---@param n integer
---@return userdata udata
function debug.setuservalue(udata, value, n) end
+---#else
+---#DES 'debug.setuservalue<5.3'
+---@param udata userdata
+---@param value any
+---@return userdata udata
+function debug.setuservalue(udata, value) end
+---#end
+---#DES 'debug.traceback'
---@param thread thread
---@param message? any
---@param level? integer
----@return string message
+---@return string message
function debug.traceback(thread, message, level) end
+---@version >5.2
+---#DES 'debug.upvalueid'
---@param f function
---@param n integer
---@return lightuserdata id
function debug.upvalueid(f, n) end
+---@version >5.2
+---#DES 'debug.upvaluejoin'
---@param f1 function
---@param n1 integer
---@param f2 function
diff --git a/meta/template/file.lua b/meta/template/file.lua
index e79c2255..7c0d22a6 100644
--- a/meta/template/file.lua
+++ b/meta/template/file.lua
@@ -1,36 +1,51 @@
---@meta
+---#DES 'file'
---@class file*
local file = {}
---@alias readmode number
----| '"n"'
----| '"a"'
----|>'"l"'
----| '"L"'
+---#if VERSION >= 5.3 then
+---| '"n"' # ---#DESENUM 'readmode.n'
+---| '"a"' # ---#DESENUM 'readmode.a'
+---|>'"l"' # ---#DESENUM 'readmode.l'
+---| '"L"' # ---#DESENUM 'readmode.L'
+---#else
+---| '"*n"' # ---#DESENUM 'readmode.n'
+---| '"*a"' # ---#DESENUM 'readmode.a'
+---|>'"*l"' # ---#DESENUM 'readmode.l'
+---#if JIT then
+---| '"*L"' # ---#DESENUM 'readmode.L'
+---#endif
+---#end
---@alias exitcode | '"exit"'|'"signal"'
+---#DES 'file:close'
---@return boolean? suc
---@return exitcode? exitcode
---@return integer? code
function file:close() end
+---#DES 'file:flush'
function file:flush() end
+---#DES 'file:lines'
---@vararg readmode
---@return fun():string|number
function file:lines(...) end
+---#DES 'file:read'
---@vararg readmode
---@return string|number
function file:read(...) end
---@alias seekwhence
----| '"set"'
----|>'"cur"'
----| '"end"'
+---| '"set"' # ---#DESENUM 'seekwhence.set'
+---|>'"cur"' # ---#DESENUM 'seekwhence.cur'
+---| '"end"' # ---#DESENUM 'seekwhence.end'
+---#DES 'file:seek'
---@param whence? seekwhence
---@param offset? integer
---@return integer offset
@@ -38,13 +53,16 @@ function file:read(...) end
function file:seek(whence, offset) end
---@alias vbuf
----| '"no"'
----| '"full"'
----| '"line"'
+---| '"no"' # ---#DESENUM 'vbuf.no'
+---| '"full"' # ---#DESENUM 'vbuf.full'
+---| '"line"' # ---#DESENUM 'vbuf.line'
+
+---#DES 'file:setvbuf'
---@param mode vbuf
---@param size integer
function file:setvbuf(mode, size) end
+---#DES 'file:write'
---@vararg string|number
---@return file?
---@return string? errmsg
diff --git a/meta/template/io.lua b/meta/template/io.lua
index 3669dd16..adf64ebc 100644
--- a/meta/template/io.lua
+++ b/meta/template/io.lua
@@ -1,5 +1,6 @@
---@meta
+---#DES 'io'
---@class io*
---@field stdin file*
---@field stdout file*
@@ -7,72 +8,84 @@
io = {}
---@alias openmode
----|>'"r"'
----| '"w"'
----| '"a"'
----| '"r+"'
----| '"w+"'
----| '"a+"'
----| '"rb"'
----| '"wb"'
----| '"ab"'
----| '"r+b"'
----| '"w+b"'
----| '"a+b"'
+---|>'"r"' # ---#DESENUM 'openmode.r'
+---| '"w"' # ---#DESENUM 'openmode.w'
+---| '"a"' # ---#DESENUM 'openmode.a'
+---| '"r+"' # ---#DESENUM 'openmode.r+'
+---| '"w+"' # ---#DESENUM 'openmode.w+'
+---| '"a+"' # ---#DESENUM 'openmode.a+'
+---| '"rb"' # ---#DESENUM 'openmode.rb'
+---| '"wb"' # ---#DESENUM 'openmode.wb'
+---| '"ab"' # ---#DESENUM 'openmode.ab'
+---| '"r+b"' # ---#DESENUM 'openmode.r+b'
+---| '"w+b"' # ---#DESENUM 'openmode.w+b'
+---| '"a+b"' # ---#DESENUM 'openmode.a+b'
+---#DES 'io.close'
---@param file? file*
---@return boolean? suc
---@return exitcode? exitcode
---@return integer? code
function io.close(file) end
+---#DES 'io.flush'
function io.flush() end
+---#DES 'io.input'
---@overload fun():file*
---@param file string|file*
function io.input(file) end
+---#DES 'io.lines'
---@param filename string?
---@vararg readmode
---@return fun():string|number
function io.lines(filename, ...) end
+---#DES 'io.open'
---@param filename string
---@param mode openmode
---@return file*?
---@return string? errmsg
function io.open(filename, mode) end
+---#DES 'io.output'
---@overload fun():file*
---@param file string|file*
function io.output(file) end
---@alias popenmode
----| '"r"'
----| '"w"'
+---| '"r"' # ---#DESENUM 'popenmode.r'
+---| '"w"' # ---#DESENUM 'popenmode.w'
+---#DES 'io.popen'
---@param prog string
---@param mode? popenmode
---@return file*?
---@return string? errmsg
function io.popen(prog, mode) end
+---#DES 'io.read'
---@vararg readmode
---@return string|number
---@return ...
function io.read(...) end
+---#DES 'io.tmpfile'
---@return file*
function io.tmpfile() end
---@alias filetype
----| '"file"'
----| '"closed file"'
----| 'nil'
+---| '"file"' # ---#DESENUM 'filetype.file'
+---| '"closed file"' # ---#DESENUM 'filetype.closed file'
+---| 'nil' # ---#DESENUM 'filetype.nil'
+
+---#DES 'io.type'
---@param file file*
---@return filetype
function io.type(file) end
+---#DES 'io.write'
---@return file*
---@return string? errmsg
function io.write(...) end