diff options
-rw-r--r-- | .luarc.json | 3 | ||||
-rw-r--r-- | locale/en-us/script.lua | 1 | ||||
-rw-r--r-- | locale/zh-cn/script.lua | 1 | ||||
-rw-r--r-- | meta/template/basic.lua | 16 | ||||
-rw-r--r-- | meta/template/bit.lua | 12 | ||||
-rw-r--r-- | meta/template/bit32.lua | 12 | ||||
-rw-r--r-- | meta/template/coroutine.lua | 6 | ||||
-rw-r--r-- | meta/template/debug.lua | 12 | ||||
-rw-r--r-- | meta/template/ffi.lua | 10 | ||||
-rw-r--r-- | meta/template/io.lua | 5 | ||||
-rw-r--r-- | meta/template/jit.lua | 1 | ||||
-rw-r--r-- | meta/template/math.lua | 34 | ||||
-rw-r--r-- | meta/template/os.lua | 6 | ||||
-rw-r--r-- | meta/template/package.lua | 1 | ||||
-rw-r--r-- | meta/template/string.lua | 17 | ||||
-rw-r--r-- | meta/template/table.lua | 4 | ||||
-rw-r--r-- | meta/template/utf8.lua | 6 |
17 files changed, 145 insertions, 2 deletions
diff --git a/.luarc.json b/.luarc.json index 8dd4a5a9..8d990d68 100644 --- a/.luarc.json +++ b/.luarc.json @@ -10,7 +10,8 @@ ], "neededFileStatus": { "undefined-field": "Any", - "await-in-sync": "Any" + "await-in-sync": "Any", + "discard-returns": "Any" }, "ignoredFiles": "Opened", "libraryFiles": "Opened" diff --git a/locale/en-us/script.lua b/locale/en-us/script.lua index 3a23eee2..9181bb60 100644 --- a/locale/en-us/script.lua +++ b/locale/en-us/script.lua @@ -44,6 +44,7 @@ DIAG_DEPRECATED = 'Deprecated.' DIAG_DIFFERENT_REQUIRES = 'The same file is required with different names.' DIAG_REDUNDANT_RETURN = 'Redundant return.' DIAG_AWAIT_IN_SYNC = 'Async function can only be called in async function.' +DIAG_DISCARD_RETURNS = 'The return values of this function cannot be discarded.' DIAG_CIRCLE_DOC_CLASS = 'Circularly inherited classes.' DIAG_DOC_FIELD_NO_CLASS = 'The field must be defined after the class.' diff --git a/locale/zh-cn/script.lua b/locale/zh-cn/script.lua index 2843d2b0..093263cd 100644 --- a/locale/zh-cn/script.lua +++ b/locale/zh-cn/script.lua @@ -44,6 +44,7 @@ DIAG_DEPRECATED = '已废弃。' DIAG_DIFFERENT_REQUIRES = '使用了不同的名字 require 了同一个文件。' DIAG_REDUNDANT_RETURN = '冗余返回。' DIAG_AWAIT_IN_SYNC = '只能在标记为异步的函数中调用异步函数。' +DIAG_DISCARD_RETURNS = '不能丢弃此函数的返回值。' DIAG_CIRCLE_DOC_CLASS = '循环继承的类。' DIAG_DOC_FIELD_NO_CLASS = '字段必须定义在类之后。' diff --git a/meta/template/basic.lua b/meta/template/basic.lua index 5665dc59..6c3f7d46 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -57,11 +57,13 @@ _G = {} ---#DES 'getfenv' ---@param f? function ---@return table +---@nodiscard function getfenv(f) end ---#DES 'getmetatable' ---@param object any ---@return table metatable +---@nodiscard function getmetatable(object) end ---#DES 'ipairs' @@ -83,6 +85,7 @@ function ipairs(t) end ---@param chunkname? string ---@return function ---@return string error_message +---@nodiscard function load(func, chunkname) end ---#else ---#DES 'load>5.2' @@ -92,6 +95,7 @@ function load(func, chunkname) end ---@param env? table ---@return function ---@return string error_message +---@nodiscard function load(chunk, chunkname, mode, env) end ---#end @@ -100,6 +104,7 @@ function load(chunk, chunkname, mode, env) end ---@param filename? string ---@return function ---@return string error_message +---@nodiscard function loadfile(filename) end ---#else ---#DES 'loadfile' @@ -108,6 +113,7 @@ function loadfile(filename) end ---@param env? table ---@return function ---@return string error_message +---@nodiscard function loadfile(filename, mode, env) end ---#end @@ -117,6 +123,7 @@ function loadfile(filename, mode, env) end ---@param chunkname? string ---@return function ---@return string error_message +---@nodiscard function loadstring(text, chunkname) end ---@version 5.1 @@ -130,6 +137,7 @@ function module(name, ...) end ---@param index? K ---@return K ---@return V +---@nodiscard function next(table, index) end ---#DES 'pairs' @@ -154,17 +162,20 @@ function print(...) end ---@param v1 any ---@param v2 any ---@return boolean +---@nodiscard function rawequal(v1, v2) end ---#DES 'rawget' ---@param table table ---@param index any ---@return any +---@nodiscard function rawget(table, index) end ---#DES 'rawlen' ---@param v table|string ---@return integer len +---@nodiscard function rawlen(v) end ---#DES 'rawset' @@ -177,6 +188,7 @@ function rawset(table, index, value) end ---#DES 'select' ---@param index integer|'"#"' ---@return any +---@nodiscard function select(index, ...) end ---@version 5.1 @@ -196,11 +208,13 @@ function setmetatable(table, metatable) end ---@param e string|number ---@param base? integer ---@return number? +---@nodiscard function tonumber(e, base) end ---#DES 'tostring' ---@param v any ---@return string +---@nodiscard function tostring(v) end ---@alias type @@ -216,6 +230,7 @@ function tostring(v) end ---#DES 'type' ---@param v any ---@return type type +---@nodiscard function type(v) end ---#DES '_VERSION' @@ -258,4 +273,5 @@ function xpcall(f, msgh, arg1, ...) end ---@param list table ---@param i? integer ---@param j? integer +---@nodiscard function unpack(list, i, j) end diff --git a/meta/template/bit.lua b/meta/template/bit.lua index d7cfd302..57bf6d31 100644 --- a/meta/template/bit.lua +++ b/meta/template/bit.lua @@ -7,62 +7,74 @@ bit = {} ---@param x integer ---@return integer y +---@nodiscard function bit.tobit(x) end ---@param x integer ---@param n? integer ---@return integer y +---@nodiscard function bit.tohex(x, n) end ---@param x integer ---@return integer y +---@nodiscard function bit.bnot(x) end ---@param x integer ---@param x2 integer ---@vararg integer ---@return integer y +---@nodiscard function bit.bor(x, x2, ...) end ---@param x integer ---@param x2 integer ---@vararg integer ---@return integer y +---@nodiscard function bit.band(x, x2, ...) end ---@param x integer ---@param x2 integer ---@vararg integer ---@return integer y +---@nodiscard function bit.bxor(x, x2, ...) end ---@param x integer ---@param n integer ---@return integer y +---@nodiscard function bit.lshift(x, n) end ---@param x integer ---@param n integer ---@return integer y +---@nodiscard function bit.rshift(x, n) end ---@param x integer ---@param n integer ---@return integer y +---@nodiscard function bit.arshift(x, n) end ---@param x integer ---@param n integer ---@return integer y +---@nodiscard function bit.rol(x, n) end ---@param x integer ---@param n integer ---@return integer y +---@nodiscard function bit.ror(x, n) end ---@param x integer ---@return integer y +---@nodiscard function bit.bswap(x) end return bit diff --git a/meta/template/bit32.lua b/meta/template/bit32.lua index 85bd04f1..bcb39c66 100644 --- a/meta/template/bit32.lua +++ b/meta/template/bit32.lua @@ -10,27 +10,33 @@ bit32 = {} ---@param x integer ---@param disp integer ---@return integer +---@nodiscard function bit32.arshift(x, disp) end ---#DES 'bit32.band' ---@return integer +---@nodiscard function bit32.band(...) end ---#DES 'bit32.bnot' ---@param x integer ---@return integer +---@nodiscard function bit32.bnot(x) end ---#DES 'bit32.bor' ---@return integer +---@nodiscard function bit32.bor(...) end ---#DES 'bit32.btest' ---@return boolean +---@nodiscard function bit32.btest(...) end ---#DES 'bit32.bxor' ---@return integer +---@nodiscard function bit32.bxor(...) end ---#DES 'bit32.extract' @@ -38,6 +44,7 @@ function bit32.bxor(...) end ---@param field integer ---@param width? integer ---@return integer +---@nodiscard function bit32.extract(n, field, width) end ---#DES 'bit32.replace' @@ -45,30 +52,35 @@ function bit32.extract(n, field, width) end ---@param v integer ---@param field integer ---@param width? integer +---@nodiscard function bit32.replace(n, v, field, width) end ---#DES 'bit32.lrotate' ---@param x integer ---@param distp integer ---@return integer +---@nodiscard function bit32.lrotate(x, distp) end ---#DES 'bit32.lshift' ---@param x integer ---@param distp integer ---@return integer +---@nodiscard function bit32.lshift(x, distp) end ---#DES 'bit32.rrotate' ---@param x integer ---@param distp integer ---@return integer +---@nodiscard function bit32.rrotate(x, distp) end ---#DES 'bit32.rshift' ---@param x integer ---@param distp integer ---@return integer +---@nodiscard function bit32.rshift(x, distp) end return bit32 diff --git a/meta/template/coroutine.lua b/meta/template/coroutine.lua index 7d8e2cb2..a9dd40cf 100644 --- a/meta/template/coroutine.lua +++ b/meta/template/coroutine.lua @@ -7,16 +7,19 @@ coroutine = {} ---#DES 'coroutine.create' ---@param f function ---@return thread +---@nodiscard function coroutine.create(f) end ---#if VERSION >= 5.4 then ---#DES 'coroutine.isyieldable>5.4' ---@param co? thread ---@return boolean +---@nodiscard function coroutine.isyieldable(co) end ---#else ---#DES 'coroutine.isyieldable' ---@return boolean +---@nodiscard function coroutine.isyieldable() end ---#end @@ -38,6 +41,7 @@ function coroutine.resume(co, val1, ...) end ---#DES 'coroutine.running' ---@return thread running ---@return boolean ismain +---@nodiscard function coroutine.running() end ---#DES 'coroutine.status' @@ -47,11 +51,13 @@ function coroutine.running() end ---| '"suspended"' # ---#DESTAIL 'costatus.suspended' ---| '"normal"' # ---#DESTAIL 'costatus.normal' ---| '"dead"' # ---#DESTAIL 'costatus.dead' +---@nodiscard function coroutine.status(co) end ---#DES 'coroutine.wrap' ---@param f function ---@return fun(...):... +---@nodiscard function coroutine.wrap(f) end ---#DES 'coroutine.yield' diff --git a/meta/template/debug.lua b/meta/template/debug.lua index 2c72263f..3f8a91a4 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -33,6 +33,7 @@ function debug.debug() end ---#DES 'debug.getfenv' ---@param o any ---@return table +---@nodiscard function debug.getfenv(o) end ---#DES 'debug.gethook' @@ -40,6 +41,7 @@ function debug.getfenv(o) end ---@return function hook ---@return string mask ---@return integer count +---@nodiscard function debug.gethook(co) end ---@alias infowhat string @@ -64,6 +66,7 @@ function debug.gethook(co) end ---@param f integer|function ---@param what? infowhat ---@return debuginfo +---@nodiscard function debug.getinfo(thread, f, what) end ---#if VERSION <= 5.1 and not JIT then @@ -74,6 +77,7 @@ function debug.getinfo(thread, f, what) end ---@param index integer ---@return string name ---@return any value +---@nodiscard function debug.getlocal(thread, level, index) end ---#else ---#DES 'debug.getlocal>5.2' @@ -83,16 +87,19 @@ function debug.getlocal(thread, level, index) end ---@param index integer ---@return string name ---@return any value +---@nodiscard function debug.getlocal(thread, f, index) end ---#end ---#DES 'debug.getmetatable' ---@param object any ---@return table metatable +---@nodiscard function debug.getmetatable(object) end ---#DES 'debug.getregistry' ---@return table +---@nodiscard function debug.getregistry() end ---#DES 'debug.getupvalue' @@ -100,6 +107,7 @@ function debug.getregistry() end ---@param up integer ---@return string name ---@return any value +---@nodiscard function debug.getupvalue(f, up) end ---#if VERSION >= 5.4 then @@ -108,11 +116,13 @@ function debug.getupvalue(f, up) end ---@param n integer ---@return any ---@return boolean +---@nodiscard function debug.getuservalue(u, n) end ---#elseif VERSION >= 5.2 or JIT then ---#DES 'debug.getuservalue<5.3' ---@param u userdata ---@return any +---@nodiscard function debug.getuservalue(u) end ---#end @@ -187,6 +197,7 @@ function debug.setuservalue(udata, value) end ---@param message? any ---@param level? integer ---@return string message +---@nodiscard function debug.traceback(thread, message, level) end ---@version >5.2, JIT @@ -194,6 +205,7 @@ function debug.traceback(thread, message, level) end ---@param f function ---@param n integer ---@return lightuserdata id +---@nodiscard function debug.upvalueid(f, n) end ---@version >5.2, JIT diff --git a/meta/template/ffi.lua b/meta/template/ffi.lua index 97dd4bc2..833232d4 100644 --- a/meta/template/ffi.lua +++ b/meta/template/ffi.lua @@ -26,21 +26,24 @@ function ffi.cdef(def) end ---@param name string ---@param global? boolean ---@return ffi.namespace* clib +---@nodiscard function ffi.load(name, global) end ---@param ct ffi.ct* ---@param nelem? integer ---@param init? any ---@return ffi.cdata* cdata +---@nodiscard function ffi.new(ct, nelem, init, ...) end ---@param nelem? integer ---@param init? any ---@return ffi.cdata* cdata -function ctype(nelem, init, ...) end +function ffi.ctype(nelem, init, ...) end ---@param ct ffi.ct* ---@return ffi.ctype* ctype +---@nodiscard function ffi.typeof(ct) end ---@param ct ffi.ct* @@ -61,10 +64,12 @@ function ffi.gc(cdata, finalizer) end ---@param ct ffi.ct* ---@param nelem? integer ---@return integer|nil size +---@nodiscard function ffi.sizeof(ct, nelem) end ---@param ct ffi.ct* ---@return integer align +---@nodiscard function ffi.alignof(ct) end ---@param ct ffi.ct* @@ -72,15 +77,18 @@ function ffi.alignof(ct) end ---@return integer ofs ---@return integer? bpos ---@return integer? bsize +---@nodiscard function ffi.offsetof(ct, field) end ---@param ct ffi.ct* ---@param obj any ---@return boolean status +---@nodiscard function ffi.istype(ct, obj) end ---@param newerr? integer ---@return integer err +---@nodiscard function ffi.errno(newerr) end ---@param ptr any diff --git a/meta/template/io.lua b/meta/template/io.lua index d31027af..1af572b6 100644 --- a/meta/template/io.lua +++ b/meta/template/io.lua @@ -50,6 +50,7 @@ function io.lines(filename, ...) end ---@param mode openmode ---@return file*? ---@return string? errmsg +---@nodiscard function io.open(filename, mode) end ---#DES 'io.output' @@ -72,10 +73,12 @@ function io.popen(prog, mode) end ---@vararg readmode ---@return string|number ---@return ... +---@nodiscard function io.read(...) end ---#DES 'io.tmpfile' ---@return file* +---@nodiscard function io.tmpfile() end ---@alias filetype @@ -86,6 +89,7 @@ function io.tmpfile() end ---#DES 'io.type' ---@param file file* ---@return filetype +---@nodiscard function io.type(file) end ---#DES 'io.write' @@ -131,6 +135,7 @@ function file:lines(...) end ---#DES 'file:read' ---@vararg readmode ---@return string|number +---@nodiscard function file:read(...) end ---@alias seekwhence diff --git a/meta/template/jit.lua b/meta/template/jit.lua index f5571cb7..6397505e 100644 --- a/meta/template/jit.lua +++ b/meta/template/jit.lua @@ -27,6 +27,7 @@ function jit.flush(func, recursive) end ---@return boolean status ---@return ... +---@nodiscard function jit.status() end return jit diff --git a/meta/template/math.lua b/meta/template/math.lua index e415bae6..67c76ff4 100644 --- a/meta/template/math.lua +++ b/meta/template/math.lua @@ -17,28 +17,33 @@ math = {} ---#DES 'math.abs' ---@param x number ---@return number +---@nodiscard function math.abs(x) end ---#DES 'math.acos' ---@param x number ---@return number +---@nodiscard function math.acos(x) end ---#DES 'math.asin' ---@param x number ---@return number +---@nodiscard function math.asin(x) end ---#if VERSION <= 5.2 then ---#DES 'math.atan<5.2' ---@param y number ---@return number +---@nodiscard function math.atan(y) end ---#else ---#DES 'math.atan>5.3' ---@param y number ---@param x? number ---@return number +---@nodiscard function math.atan(y, x) end ---#end @@ -47,42 +52,50 @@ function math.atan(y, x) end ---@param y number ---@param x number ---@return number +---@nodiscard function math.atan2(y, x) end ---#DES 'math.ceil' ---@param x number ---@return integer +---@nodiscard function math.ceil(x) end ---#DES 'math.cos' ---@param x number +---@nodiscard function math.cos(x) end ---@version <5.2 ---#DES 'math.cosh' ---@param x number ---@return number +---@nodiscard function math.cosh(x) end ---#DES 'math.deg' ---@param x number ---@return number +---@nodiscard function math.deg(x) end ---#DES 'math.exp' ---@param x number ---@return number +---@nodiscard function math.exp(x) end ---#DES 'math.floor' ---@param x number ---@return number +---@nodiscard function math.floor(x) end ---#DES 'math.fmod' ---@param x number ---@param y number ---@return number +---@nodiscard function math.fmod(x, y) end ---@version <5.2 @@ -90,6 +103,7 @@ function math.fmod(x, y) end ---@param x number ---@return number m ---@return number e +---@nodiscard function math.frexp(x) end ---@version <5.2 @@ -97,18 +111,21 @@ function math.frexp(x) end ---@param m number ---@param e number ---@return number +---@nodiscard function math.ldexp(m, e) end ---#if VERSION <= 5.1 and not JIT then ---#DES 'math.log<5.1' ---@param x number ---@return number +---@nodiscard function math.log(x) end ---#else ---#DES 'math.log>5.2' ---@param x number ---@param base? integer ---@return number +---@nodiscard function math.log(x, base) end ---#end @@ -116,24 +133,28 @@ function math.log(x, base) end ---#DES 'math.log10' ---@param x number ---@return number +---@nodiscard function math.log10(x) end ---#DES 'math.max' ---@param x number ---@vararg number ---@return number +---@nodiscard function math.max(x, ...) end ---#DES 'math.min' ---@param x number ---@vararg number ---@return number +---@nodiscard function math.min(x, ...) end ---#DES 'math.modf' ---@param x number ---@return integer ---@return number +---@nodiscard function math.modf(x) end ---@version <5.2 @@ -141,11 +162,13 @@ function math.modf(x) end ---@param x number ---@param y number ---@return number +---@nodiscard function math.pow(x, y) end ---#DES 'math.rad' ---@param x number ---@return number +---@nodiscard function math.rad(x) end ---#DES 'math.random' @@ -154,50 +177,59 @@ function math.rad(x) end ---@param m integer ---@param n integer ---@return integer +---@nodiscard function math.random(m, n) end ---#if VERSION >= 5.4 then ---#DES 'math.randomseed>5.4' ---@param x? integer ---@param y? integer +---@nodiscard function math.randomseed(x, y) end ---#else ---#DES 'math.randomseed<5.3' ---@param x integer +---@nodiscard function math.randomseed(x) end ---#end ---#DES 'math.sin' ---@param x number ---@return number +---@nodiscard function math.sin(x) end ---@version <5.2 ---#DES 'math.sinh' ---@param x number ---@return number +---@nodiscard function math.sinh(x) end ---#DES 'math.sqrt' ---@param x number ---@return number +---@nodiscard function math.sqrt(x) end ---#DES 'math.tan' ---@param x number ---@return number +---@nodiscard function math.tan(x) end ---@version <5.2 ---#DES 'math.tanh' ---@param x number ---@return number +---@nodiscard function math.tanh(x) end ---@version >5.3 ---#DES 'math.tointeger' ---@param x number ---@return integer? +---@nodiscard function math.tointeger(x) end ---#DES 'math.type' @@ -206,12 +238,14 @@ function math.tointeger(x) end ---| '"integer"' ---| '"float"' ---| 'nil' +---@nodiscard function math.type(x) end ---#DES 'math.ult' ---@param m integer ---@param n integer ---@return boolean +---@nodiscard function math.ult(m, n) end return math diff --git a/meta/template/os.lua b/meta/template/os.lua index 4347076c..af9b3278 100644 --- a/meta/template/os.lua +++ b/meta/template/os.lua @@ -6,6 +6,7 @@ os = {} ---#DES 'os.clock' ---@return number +---@nodiscard function os.clock() end ---@class osdate @@ -32,12 +33,14 @@ function os.clock() end ---@param format? string ---@param time? integer ---@return string|osdate +---@nodiscard function os.date(format, time) end ---#DES 'os.difftime' ---@param t2 integer ---@param t1 integer ---@return integer +---@nodiscard function os.difftime(t2, t1) end ---#DES 'os.execute' @@ -67,6 +70,7 @@ function os.exit(code, close) end ---#DES 'os.getenv' ---@param varname string ---@return string +---@nodiscard function os.getenv(varname) end ---#DES 'os.remove' @@ -99,10 +103,12 @@ function os.setlocale(locale, category) end ---#DES 'os.time' ---@param date? osdate ---@return integer +---@nodiscard function os.time(date) end ---#DES 'os.tmpname' ---@return string +---@nodiscard function os.tmpname() end return os diff --git a/meta/template/package.lua b/meta/template/package.lua index 0b2c8c1b..5c08bbef 100644 --- a/meta/template/package.lua +++ b/meta/template/package.lua @@ -55,6 +55,7 @@ package.searchers = {} ---@param rep? string ---@return string? filename ---@return string? errmsg +---@nodiscard function package.searchpath(name, path, sep, rep) end ---#DES 'package.seeall' diff --git a/meta/template/string.lua b/meta/template/string.lua index c06570e8..97bae481 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -10,6 +10,7 @@ string = {} ---@param j? integer ---@return integer ---@return ... +---@nodiscard function string.byte(s, i, j) end ---#DES 'string.char' @@ -17,12 +18,14 @@ function string.byte(s, i, j) end ---@vararg integer ---@return string ---@return ... +---@nodiscard function string.char(byte, ...) end ---#DES 'string.dump' ---@param f function ---@param strip? boolean ---@return string +---@nodiscard function string.dump(f, strip) end ---#DES 'string.find' @@ -33,12 +36,14 @@ function string.dump(f, strip) end ---@return integer start ---@return integer end ---@return ... captured +---@nodiscard function string.find(s, pattern, init, plain) end ---#DES 'string.format' ---@param s string ---@vararg string ---@return string +---@nodiscard function string.format(s, ...) end ---#DES 'string.gmatch' @@ -62,16 +67,19 @@ function string.gmatch(s, pattern, init) end ---@param n integer ---@return string ---@return integer count +---@nodiscard function string.gsub(s, pattern, repl, n) end ---#DES 'string.len' ---@param s string ---@return integer +---@nodiscard function string.len(s) end ---#DES 'string.lower' ---@param s string ---@return string +---@nodiscard function string.lower(s) end ---#DES 'string.match' @@ -79,6 +87,7 @@ function string.lower(s) end ---@param pattern string ---@param init? integer ---@return string | number captured +---@nodiscard function string.match(s, pattern, init) end ---@version >5.3 @@ -88,12 +97,14 @@ function string.match(s, pattern, init) end ---@param v2? string ---@vararg string ---@return string binary +---@nodiscard function string.pack(fmt, v1, v2, ...) end ---@version >5.3 ---#DES 'string.packsize' ---@param fmt string ---@return integer +---@nodiscard function string.packsize(fmt) end ---#if VERSION <= 5.1 and not JIT then @@ -101,6 +112,7 @@ function string.packsize(fmt) end ---@param s string ---@param n integer ---@return string +---@nodiscard function string.rep(s, n) end ---#else ---#DES 'string.rep>5.2' @@ -108,12 +120,14 @@ function string.rep(s, n) end ---@param n integer ---@param sep? string ---@return string +---@nodiscard function string.rep(s, n, sep) end ---#end ---#DES 'string.reverse' ---@param s string ---@return string +---@nodiscard function string.reverse(s) end ---#DES 'string.sub' @@ -121,6 +135,7 @@ function string.reverse(s) end ---@param i integer ---@param j? integer ---@return string +---@nodiscard function string.sub(s, i, j) end ---@version >5.3 @@ -130,11 +145,13 @@ function string.sub(s, i, j) end ---@param pos? integer ---@return ... ---@return integer offset +---@nodiscard function string.unpack(fmt, s, pos) end ---#DES 'string.upper' ---@param s string ---@return string +---@nodiscard function string.upper(s) end return string diff --git a/meta/template/table.lua b/meta/template/table.lua index 12d69c43..c55c3160 100644 --- a/meta/template/table.lua +++ b/meta/template/table.lua @@ -10,6 +10,7 @@ table = {} ---@param i? integer ---@param j? integer ---@return string +---@nodiscard function table.concat(list, sep, i, j) end ---#DES 'table.insert' @@ -23,6 +24,7 @@ function table.insert(list, pos, value) end ---#DES 'table.maxn' ---@param table table ---@return integer +---@nodiscard function table.maxn(table) end ---@version >5.3 @@ -38,6 +40,7 @@ function table.move(a1, f, e, t, a2) end ---@version >5.2, JIT ---#DES 'table.pack' ---@return table +---@nodiscard function table.pack(...) end ---#DES 'table.remove' @@ -56,6 +59,7 @@ function table.sort(list, comp) end ---@param list table ---@param i? integer ---@param j? integer +---@nodiscard function table.unpack(list, i, j) end return table diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua index 43ce9961..d3ff940e 100644 --- a/meta/template/utf8.lua +++ b/meta/template/utf8.lua @@ -12,6 +12,7 @@ utf8 = {} ---@param code integer ---@vararg integer ---@return string +---@nodiscard function utf8.char(code, ...) end ---#DES 'utf8.codes' @@ -33,6 +34,7 @@ function utf8.codes(s, lax) end ---@param j? integer ---@return integer code ---@return ... +---@nodiscard function utf8.codepoint(s, i, j) end ---#else ---@param s string @@ -41,6 +43,7 @@ function utf8.codepoint(s, i, j) end ---@param lax? boolean ---@return integer code ---@return ... +---@nodiscard function utf8.codepoint(s, i, j, lax) end ---#end @@ -51,6 +54,7 @@ function utf8.codepoint(s, i, j, lax) end ---@param j? integer ---@return integer? ---@return integer? errpos +---@nodiscard function utf8.len(s, i, j) end ---#else ---@param s string @@ -59,6 +63,7 @@ function utf8.len(s, i, j) end ---@param lax? boolean ---@return integer? ---@return integer? errpos +---@nodiscard function utf8.len(s, i, j, lax) end ---#end @@ -67,6 +72,7 @@ function utf8.len(s, i, j, lax) end ---@param n integer ---@param i integer ---@return integer p +---@nodiscard function utf8.offset(s, n, i) end return utf8 |