diff options
Diffstat (limited to 'meta/template')
-rw-r--r-- | meta/template/basic.lua | 26 | ||||
-rw-r--r-- | meta/template/debug.lua | 12 | ||||
-rw-r--r-- | meta/template/string.lua | 100 | ||||
-rw-r--r-- | meta/template/table.lua | 44 | ||||
-rw-r--r-- | meta/template/utf8.lua | 36 |
5 files changed, 197 insertions, 21 deletions
diff --git a/meta/template/basic.lua b/meta/template/basic.lua index ad12e980..1e86d828 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -1,10 +1,10 @@ ---@type table arg = {} ----@generic ANY ----@param v ANY +---@generic T +---@param v T ---@param message any ----@return ANY +---@return T function assert(v, message) end ---@alias cgopt54 @@ -42,10 +42,9 @@ function getfenv(f) end ---@return table metatable function getmetatable(object) end ----@generic TABLE: table ----@param t TABLE +---@param t table ---@return fun(t: table, i: integer?):integer, any iterator ----@return TABLE t +---@return table t ---@return integer i function ipairs(t) end @@ -90,10 +89,9 @@ function module(name, ...) end ---@return any value function next(table, index) end ----@generic TABLE: table ----@param t TABLE +---@param t table ---@return function next ----@return TABLE +---@return table ---@return nil function pairs(t) return next @@ -122,11 +120,10 @@ function rawget(table, index) end ---@return integer len function rawlen(v) end ----@generic TABLE table ----@param table TABLE +---@param table table ---@param index any ---@param value any ----@return TABLE +---@return table function rawset(table, index, value) end ---@param index integer|'"#"' @@ -141,10 +138,9 @@ function select(index, ...) end ---@return function function setfenv(f, table) end ----@generic TABLE: table ----@param table TABLE +---@param table table ---@param metatable table ----@return TABLE +---@return table function setmetatable(table, metatable) end ---@param e string|number diff --git a/meta/template/debug.lua b/meta/template/debug.lua index b957d948..f599655c 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -80,10 +80,10 @@ function debug.getuservalue(u, n) end ---@return integer|boolean function debug.setcstacklimit(limit) end ----@generic ANY ----@param object ANY +---@generic T +---@param object T ---@param env table ----@return ANY object +---@return T object function debug.setfenv(object, env) end ---@alias hookmask @@ -106,10 +106,10 @@ function debug.sethook(thread, hook, mask, count) end ---@return string name function debug.setlocal(thread, level, index, value) end ----@generic ANY ----@param value ANY +---@generic T +---@param value T ---@param meta table ----@return ANY value +---@return T value function debug.setmetatable(value, meta) end ---@param f function diff --git a/meta/template/string.lua b/meta/template/string.lua index e69de29b..a7bfebe8 100644 --- a/meta/template/string.lua +++ b/meta/template/string.lua @@ -0,0 +1,100 @@ +---@class string +string = {} + +---@param s string +---@param i integer? +---@param j integer? +---@return integer +---@return ... +function string.byte(s, i, j) end + +---@param byte integer +---@vararg integer +---@return string +---@return ... +function string.char(byte, ...) end + +---@param f function +---@param strip boolean? +---@return string +function string.dump(f, strip) end + +---@param s string +---@param pattern string +---@param init integer? +---@param plain boolean? +---@return integer start +---@return integer end +---@return ... captured +function string.find(s, pattern, init, plain) end + +---@param s string +---@vararg string +---@return string +function string.format(s, ...) end + +---@param s string +---@param pattern string +---@param init integer? +---@return fun():string, ... +function string.gmatch(s, pattern, init) end + +---@param s string +---@param pattern string +---@param repl string|table|function +---@param n integer +---@return string +---@return integer count +function string.gsub(s, pattern, repl, n) end + +---@param s string +---@return integer +function string.len(s) end + +---@param s string +---@return string +function string.lower(s) end + +---@param s string +---@param pattern string +---@param init integer? +---@return string captured +function string.match(s, pattern, init) end + +---@param fmt string +---@param v1 string +---@param v2 string? +---@vararg string +---@return string binary +function string.pack(fmt, v1, v2, ...) end + +---@param fmt string +---@return integer +function string.packsize(fmt) end + +---@param s string +---@param n integer +---@param sep string? +---@return string +function string.rep(s, n, sep) end + +---@param s string +---@return string +function string.reverse(s) end + +---@param s string +---@param i integer +---@param j integer? +---@return string +function string.sub(s, i, j) end + +---@param fmt string +---@param s string +---@param pos integer? +---@return ... +---@return integer offset +function string.unpack(fmt, s, pos) end + +---@param s string +---@return string +function string.upper(s) end diff --git a/meta/template/table.lua b/meta/template/table.lua new file mode 100644 index 00000000..43e709fb --- /dev/null +++ b/meta/template/table.lua @@ -0,0 +1,44 @@ +---@class table +table = {} + +---@param list table +---@param sep string? +---@param i integer? +---@param j integer? +---@return string +function table.concat(list, sep, i, j) end + +---@overload fun(list: table, value: any) +---@param list table +---@param pos integer +---@param value any +function table.insert(list, pos, value) end + +---@param table table +---@return integer +function table.maxn(table) end + +---@param a1 table +---@param f integer +---@param e integer +---@param t integer +---@param a2 table? +---@return table a2 +function table.move(a1, f, e, t, a2) end + +---@return table +function table.pack(...) end + +---@param list table +---@param pos integer? +---@return any +function table.remove(list, pos) end + +---@param list table +---@param comp fun(a: any, b: any):boolean +function table.sort(list, comp) end + +---@param list table +---@param i integer? +---@param j integer? +function table.unpack(list, i, j) end diff --git a/meta/template/utf8.lua b/meta/template/utf8.lua new file mode 100644 index 00000000..cc4deca8 --- /dev/null +++ b/meta/template/utf8.lua @@ -0,0 +1,36 @@ +---@class utf8 +utf8 = {} + +---@param code integer +---@vararg integer +---@return string +function utf8.char(code, ...) end + +utf8.charpattern = '[\0-\x7F\xC2-\xF4][\x80-\xBF]*' + +---@param s string +---@param lax boolean? +---@return fun():integer, integer +function utf8.codes(s, lax) end + +---@param s string +---@param i integer? +---@param j integer? +---@param lax boolean? +---@return integer code +---@return ... +function utf8.codepoint(s, i, j, lax) end + +---@param s string +---@param i integer? +---@param j integer? +---@param lax boolean? +---@return integer? +---@return integer errpos? +function utf8.len(s, i, j, lax) end + +---@param s string +---@param n integer +---@param i integer +---@return integer p +function utf8.offset(s, n, i) end |