diff options
Diffstat (limited to 'meta/template')
-rw-r--r-- | meta/template/math.lua | 68 | ||||
-rw-r--r-- | meta/template/os.lua | 25 |
2 files changed, 89 insertions, 4 deletions
diff --git a/meta/template/math.lua b/meta/template/math.lua index 11dc6e9a..a825d905 100644 --- a/meta/template/math.lua +++ b/meta/template/math.lua @@ -1,108 +1,150 @@ ---@meta +---@DES 'math' ---@class math* ---@field huge number +---#if VERSION >= 5.3 then ---@field maxinteger integer ---@field mininteger integer +---#end ---@field pi number math = {} +---@DES 'math.abs' ---@param x number ---@return number function math.abs(x) end +---@DES 'math.acos' ---@param x number ---@return number function math.acos(x) end +---@DES 'math.asin' ---@param x number ---@return number function math.asin(x) end +---#if VERSION <= 5.2 then +---@DES 'math.atan<5.2' ---@param y number ----@param x number +---@return number +function math.atan(y) end +---#else +---@DES 'math.atan>5.3' +---@param y number +---@param x? number ---@return number function math.atan(y, x) end +---#end +---@version <5.2 +---@DES 'math.atan2' ---@param y number ---@param x number ---@return number - ----@param y any ----@param x any function math.atan2(y, x) end +---@DES 'math.ceil' ---@param x number ---@return integer function math.ceil(x) end +---@DES 'math.cos' ---@param x number function math.cos(x) end +---@version <5.2 +---@DES 'math.cosh' ---@param x number ---@return number function math.cosh(x) end +---@DES 'math.deg' ---@param x number ---@return number function math.deg(x) end +---@DES 'math.exp' ---@param x number ---@return number function math.exp(x) end +---@DES 'math.floor' ---@param x number ---@return number function math.floor(x) end +---@DES 'math.fmod' ---@param x number ---@param y number ---@return number function math.fmod(x, y) end +---@version <5.2 +---@DES 'math.frexp' ---@param x number ---@return number m ---@return number e function math.frexp(x) end +---@version <5.2 +---@DES 'math.ldexp' ---@param m number ---@param e number ---@return number function math.ldexp(m, e) end +---#if VERSION <= 5.1 then +---@DES 'math.log<5.1' +---@param x number +---@return number +function math.log(x) end +---#else +---@DES 'math.log>5.2' ---@param x number ---@param base? integer ---@return number function math.log(x, base) end +---#end +---@version <5.1 +---@DES 'math.log10' ---@param x number ---@return number function math.log10(x) end +---@DES 'math.max' ---@param x number ---@vararg number ---@return number function math.max(x, ...) end +---@DES 'math.min' ---@param x number ---@vararg number ---@return number function math.min(x, ...) end +---@DES 'math.modf' ---@param x number ---@return integer ---@return number function math.modf(x) end +---@version <5.2 +---@DES 'math.pow' ---@param x number ---@param y number ---@return number function math.pow(x, y) end +---@DES 'math.rad' ---@param x number ---@return number function math.rad(x) end +---@DES 'math.random' ---@overload fun():number ---@overload fun(m: integer):integer ---@param m integer @@ -110,34 +152,51 @@ function math.rad(x) end ---@return integer function math.random(m, n) end +---#if VERSION >= 5.4 then +---@DES 'math.randomseed>5.4' ---@param x? integer ---@param y? integer function math.randomseed(x, y) end +---#else +---@DES 'math.randomseed<5.3' +---@param x integer +function math.randomseed(x) end +---#end +---@DES 'math.sin' ---@param x number ---@return number function math.sin(x) end +---@version <5.2 +---@DES 'math.sinh' ---@param x number ---@return number function math.sinh(x) end +---@DES 'math.sqrt' ---@param x number ---@return number function math.sqrt(x) end +---@DES 'math.tan' ---@param x number ---@return number function math.tan(x) end +---@version <5.2 +---@DES 'math.tanh' ---@param x number ---@return number function math.tanh(x) end +---@version >5.3 +---@DES 'math.tointeger' ---@param x number ---@return integer? function math.tointeger(x) end +---@DES 'math.type' ---@param x any ---@return ---| '"integer"' @@ -145,6 +204,7 @@ function math.tointeger(x) end ---| 'nil' function math.type(x) end +---@DES 'math.ult' ---@param m integer ---@param n integer ---@return boolean diff --git a/meta/template/os.lua b/meta/template/os.lua index 173900eb..1410d69f 100644 --- a/meta/template/os.lua +++ b/meta/template/os.lua @@ -1,40 +1,62 @@ ---@meta +---#DES 'os' ---@class os* os = {} +---#DES 'os.clock' ---@return number function os.clock() end +---#DES 'os.date' ---@param format? string ---@param time? integer ---@return string function os.date(format, time) end +---#DES 'os.difftime' ---@param t2 integer ---@param t1 integer ---@return integer function os.difftime(t2, t1) end +---#if VERSION <= 5.1 then +---#DES 'os.execute<5.1' +---@param command string +---@return integer code +function os.execute(command) end +---#else +---#DES 'os.execute>5.2' ---@param command string ---@return boolean? suc ---@return exitcode? exitcode ---@return integer? code function os.execute(command) end +---#end +---#if VERSION <= 5.1 and not JIT then +---#DES 'os.exit<5.1' +---@param code? integer +function os.exit(code, close) end +---#else +---#DES 'os.exit>5.2' ---@param code? boolean|integer ---@param close? boolean function os.exit(code, close) end +---#end +---#DES 'os.getenv' ---@param varname string ---@return string function os.getenv(varname) end +---#DES 'os.remove' ---@param filename string ---@return boolean suc ---@return string? errmsg function os.remove(filename) end +---#DES 'os.rename' ---@param oldname string ---@param newname string ---@return boolean suc @@ -49,15 +71,18 @@ function os.rename(oldname, newname) end ---| '"numeric"' ---| '"time"' +---#DES 'os.setlocale' ---@param locale string|nil ---@param category? localecategory ---@return string localecategory function os.setlocale(locale, category) end +---#DES 'os.time' ---@param date? table ---@return integer function os.time(date) end +---#DES 'os.tmpname' ---@return string function os.tmpname() end |