diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/3rd/lovr/library/lovr.math.lua | 42 | ||||
-rw-r--r-- | meta/template/basic.lua | 16 | ||||
-rw-r--r-- | meta/template/builtin.lua | 10 | ||||
-rw-r--r-- | meta/template/debug.lua | 2 | ||||
-rw-r--r-- | meta/template/table.lua | 31 |
5 files changed, 88 insertions, 13 deletions
diff --git a/meta/3rd/lovr/library/lovr.math.lua b/meta/3rd/lovr/library/lovr.math.lua index 7cf348c6..3ce62dd9 100644 --- a/meta/3rd/lovr/library/lovr.math.lua +++ b/meta/3rd/lovr/library/lovr.math.lua @@ -644,6 +644,20 @@ local Vec2 = {} function Vec2:add(u) end --- +---Returns the angle between vectors. +--- +--- +---### NOTE: +---If any of the two vectors have a length of zero, the angle between them is not well defined. +--- +---In this case the function returns `math.pi / 2`. +--- +---@overload fun(self: lovr.Vec2, x: number, y: number):number +---@param u lovr.Vec2 # The other vector. +---@return number angle # The angle to the other vector, in radians. +function Vec2:angle(u) end + +--- ---Returns the distance to another vector. --- ---@overload fun(self: lovr.Vec2, x: number, y: number):number @@ -749,6 +763,20 @@ local Vec3 = {} function Vec3:add(u) end --- +---Returns the angle between vectors. +--- +--- +---### NOTE: +---If any of the two vectors have a length of zero, the angle between them is not well defined. +--- +---In this case the function returns `math.pi / 2`. +--- +---@overload fun(self: lovr.Vec3, x: number, y: number, z: number):number +---@param u lovr.Vec3 # The other vector. +---@return number angle # The angle to the other vector, in radians. +function Vec3:angle(u) end + +--- ---Sets this vector to be equal to the cross product between this vector and another one. --- ---The new `v` will be perpendicular to both the old `v` and `u`. @@ -873,6 +901,20 @@ local Vec4 = {} function Vec4:add(u) end --- +---Returns the angle between vectors. +--- +--- +---### NOTE: +---If any of the two vectors have a length of zero, the angle between them is not well defined. +--- +---In this case the function returns `math.pi / 2`. +--- +---@overload fun(self: lovr.Vec4, x: number, y: number, z: number, w: number):number +---@param u lovr.Vec4 # The other vector. +---@return number angle # The angle to other vector, in radians. +function Vec4:angle(u) end + +--- ---Returns the distance to another vector. --- ---@overload fun(self: lovr.Vec4, x: number, y: number, z: number, w: number):number diff --git a/meta/template/basic.lua b/meta/template/basic.lua index b26d3959..aed3085e 100644 --- a/meta/template/basic.lua +++ b/meta/template/basic.lua @@ -11,7 +11,7 @@ arg = {} ---@return T function assert(v, message) end ----@alias cgopt +---@alias gcoptions ---|>'"collect"' # ---#DESTAIL 'cgopt.collect' ---| '"stop"' # ---#DESTAIL 'cgopt.stop' ---| '"restart"' # ---#DESTAIL 'cgopt.restart' @@ -28,12 +28,12 @@ function assert(v, message) end ---#if VERSION >= 5.4 then ---#DES 'collectgarbage' ----@param opt? cgopt +---@param opt? gcoptions ---@return any function collectgarbage(opt, ...) end ---#else ---#DES 'collectgarbage' ----@param opt? cgopt +---@param opt? gcoptions ---@param arg? integer ---@return any function collectgarbage(opt, arg) end @@ -127,6 +127,12 @@ function loadfile(filename, mode, env) end function loadstring(text, chunkname) end ---@version 5.1 +---@param proxy boolean|table +---@return userdata +---@nodiscard +function newproxy(proxy) end + +---@version 5.1 ---#DES 'module' ---@param name string function module(name, ...) end @@ -274,8 +280,10 @@ function xpcall(f, msgh, arg1, ...) end ---@version 5.1 ---#DES 'unpack' ----@param list table +---@generic T +---@param list T[] ---@param i? integer ---@param j? integer +---@return T ---@nodiscard function unpack(list, i, j) end diff --git a/meta/template/builtin.lua b/meta/template/builtin.lua index 06974076..2ef14f53 100644 --- a/meta/template/builtin.lua +++ b/meta/template/builtin.lua @@ -5,14 +5,10 @@ ---@class nil ---@class boolean ---@class number ----#if VERSION >= 5.3 then ----@class integer ----#else ----@alias integer number ----#end +---@class integer: number ---@class thread ----@class table ----@class string +---@class table<K, V>: { [K]: V } +---@class string: stringlib ---@class userdata ---@class lightuserdata ---@class function diff --git a/meta/template/debug.lua b/meta/template/debug.lua index c8b506f5..6e74e1f6 100644 --- a/meta/template/debug.lua +++ b/meta/template/debug.lua @@ -15,7 +15,7 @@ debug = {} ---@field currentline integer ---@field istailcall boolean ---@field nups integer ----#if VERSION >= 5.2 then +---#if VERSION >= 5.2 or JIT then ---@field nparams integer ---@field isvararg boolean ---#end diff --git a/meta/template/table.lua b/meta/template/table.lua index c55c3160..21c8b619 100644 --- a/meta/template/table.lua +++ b/meta/template/table.lua @@ -56,10 +56,39 @@ function table.sort(list, comp) end ---@version >5.2, JIT ---#DES 'table.unpack' ----@param list table +---@generic T +---@param list T[] ---@param i? integer ---@param j? integer +---@return T ---@nodiscard function table.unpack(list, i, j) end +---@version <5.1, JIT +---#DES 'table.foreach' +---@generic T +---@param list any +---@param callback fun(key: string, value: any):T|nil +---@return T|nil +---@deprecated +function table.foreach(list, callback) end + +---@version <5.1, JIT +---#DES 'table.foreachi' +---@generic T +---@param list any +---@param callback fun(key: string, value: any):T|nil +---@return T|nil +---@deprecated +function table.foreachi(list, callback) end + +---@version <5.1, JIT +---#DES 'table.getn' +---@generic T +---@param list T[] +---@return integer +---@nodiscard +---@deprecated +function table.getn(list) end + return table |