diff options
-rw-r--r-- | .vscode/launch.json | 3 | ||||
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.audio.lua | 40 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.event.lua | 17 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.font.lua | 2 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.graphics.lua | 137 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.image.lua | 20 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.lua | 1 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.math.lua | 45 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.mouse.lua | 14 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.physics.lua | 187 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.sound.lua | 6 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.timer.lua | 3 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.touch.lua | 2 | ||||
-rw-r--r-- | meta/3rd/love2d/library/love.window.lua | 10 | ||||
-rw-r--r-- | tools/love-api.lua | 4 |
16 files changed, 404 insertions, 88 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json index b39fa4b5..855444c9 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -39,7 +39,8 @@ "name": "love-api", "type": "lua", "request": "launch", - "stopOnEntry": false, + "756stopOnEntry": false, + "luaexe": "${workspaceFolder}/bin/Windows/lua-language-server.exe", "program": "${workspaceRoot}/tools/love-api.lua", "cpath": "${workspaceFolder}/bin/Windows/?.dll", "arg": [ diff --git a/changelog.md b/changelog.md index 3d9fcf9f..312e9ed8 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,7 @@ * `FIX` [#748](https://github.com/sumneko/lua-language-server/issues/748) * `FIX` [#749](https://github.com/sumneko/lua-language-server/issues/749) * `FIX` [#752](https://github.com/sumneko/lua-language-server/issues/752) +* `FIX` [#756](https://github.com/sumneko/lua-language-server/issues/756) ## 2.4.5 `2021-10-18` diff --git a/meta/3rd/love2d/library/love.audio.lua b/meta/3rd/love2d/library/love.audio.lua index a0a8b3bd..3849b7fb 100644 --- a/meta/3rd/love2d/library/love.audio.lua +++ b/meta/3rd/love2d/library/love.audio.lua @@ -63,6 +63,9 @@ function love.audio.getOrientation() end --- ---Returns the position of the listener. Please note that positional audio only works for mono (i.e. non-stereo) sources. --- +---@return number x # The X position of the listener. +---@return number y # The Y position of the listener. +---@return number z # The Z position of the listener. function love.audio.getPosition() end --- @@ -84,6 +87,9 @@ function love.audio.getSourceCount() end --- ---Returns the velocity of the listener. --- +---@return number x # The X velocity of the listener. +---@return number y # The Y velocity of the listener. +---@return number z # The Z velocity of the listener. function love.audio.getVelocity() end --- @@ -182,12 +188,18 @@ function love.audio.setOrientation(fx, fy, fz, ux, uy, uz) end --- ---Sets the position of the listener, which determines how sounds play. --- -function love.audio.setPosition() end +---@param x number # The x position of the listener. +---@param y number # The y position of the listener. +---@param z number # The z position of the listener. +function love.audio.setPosition(x, y, z) end --- ---Sets the velocity of the listener. --- -function love.audio.setVelocity() end +---@param x number # The X velocity of the listener. +---@param y number # The Y velocity of the listener. +---@param z number # The Z velocity of the listener. +function love.audio.setVelocity(x, y, z) end --- ---Sets the master volume. @@ -325,6 +337,9 @@ function Source:getCone() end --- ---Gets the direction of the Source. --- +---@return number x # The X part of the direction vector. +---@return number y # The Y part of the direction vector. +---@return number z # The Z part of the direction vector. function Source:getDirection() end --- @@ -365,6 +380,9 @@ function Source:getPitch() end --- ---Gets the position of the Source. --- +---@return number x # The X position of the Source. +---@return number y # The Y position of the Source. +---@return number z # The Z position of the Source. function Source:getPosition() end --- @@ -382,6 +400,9 @@ function Source:getType() end --- ---Gets the velocity of the Source. --- +---@return number x # The X part of the velocity vector. +---@return number y # The Y part of the velocity vector. +---@return number z # The Z part of the velocity vector. function Source:getVelocity() end --- @@ -472,7 +493,10 @@ function Source:setCone(innerAngle, outerAngle, outerVolume) end --- ---Sets the direction vector of the Source. A zero vector makes the source non-directional. --- -function Source:setDirection() end +---@param x number # The X part of the direction vector. +---@param y number # The Y part of the direction vector. +---@param z number # The Z part of the direction vector. +function Source:setDirection(x, y, z) end --- ---Applies an audio effect to the Source. @@ -508,7 +532,10 @@ function Source:setPitch(pitch) end --- ---Sets the position of the Source. Please note that this only works for mono (i.e. non-stereo) sound files! --- -function Source:setPosition() end +---@param x number # The X position of the Source. +---@param y number # The Y position of the Source. +---@param z number # The Z position of the Source. +function Source:setPosition(x, y, z) end --- ---Sets whether the Source's position, velocity, direction, and cone angles are relative to the listener, or absolute. @@ -531,7 +558,10 @@ function Source:setRolloff(rolloff) end --- ---This does '''not''' change the position of the Source, but lets the application know how it has to calculate the doppler effect. --- -function Source:setVelocity() end +---@param x number # The X part of the velocity vector. +---@param y number # The Y part of the velocity vector. +---@param z number # The Z part of the velocity vector. +function Source:setVelocity(x, y, z) end --- ---Sets the current volume of the Source. diff --git a/meta/3rd/love2d/library/love.event.lua b/meta/3rd/love2d/library/love.event.lua index 759b5b36..b6523b9e 100644 --- a/meta/3rd/love2d/library/love.event.lua +++ b/meta/3rd/love2d/library/love.event.lua @@ -14,6 +14,7 @@ function love.event.clear() end --- ---Returns an iterator for messages in the event queue. --- +---@return function i # Iterator function usable in a for loop. function love.event.poll() end --- @@ -32,7 +33,14 @@ function love.event.pump() end --- ---From 0.10.0 onwards, you may pass an arbitrary amount of arguments with this function, though the default callbacks don't ever use more than six. --- -function love.event.push() end +---@param n love.Event # The name of the event. +---@param a any # First event argument. +---@param b any # Second event argument. +---@param c any # Third event argument. +---@param d any # Fourth event argument. +---@param e any # Fifth event argument. +---@param f any # Sixth event argument. +function love.event.push(n, a, b, c, d, e, f) end --- ---Adds the quit event to the queue. @@ -46,6 +54,13 @@ function love.event.quit(exitstatus) end --- ---Like love.event.poll(), but blocks until there is an event in the queue. --- +---@return love.Event n # The name of event. +---@return any a # First event argument. +---@return any b # Second event argument. +---@return any c # Third event argument. +---@return any d # Fourth event argument. +---@return any e # Fifth event argument. +---@return any f # Sixth event argument. function love.event.wait() end --- diff --git a/meta/3rd/love2d/library/love.font.lua b/meta/3rd/love2d/library/love.font.lua index 1efbf057..807c01aa 100644 --- a/meta/3rd/love2d/library/love.font.lua +++ b/meta/3rd/love2d/library/love.font.lua @@ -79,6 +79,8 @@ function GlyphData:getBearing() end --- ---Gets glyph bounding box. --- +---@return number x # Glyph position x. +---@return number y # Glyph position y. ---@return number width # Glyph width. ---@return number height # Glyph height. function GlyphData:getBoundingBox() end diff --git a/meta/3rd/love2d/library/love.graphics.lua b/meta/3rd/love2d/library/love.graphics.lua index f70efefd..ad4e1385 100644 --- a/meta/3rd/love2d/library/love.graphics.lua +++ b/meta/3rd/love2d/library/love.graphics.lua @@ -25,11 +25,13 @@ function love.graphics.applyTransform(transform) end --- ---@overload fun(drawmode: love.DrawMode, arctype: love.ArcType, x: number, y: number, radius: number, angle1: number, angle2: number, segments: number) ---@param drawmode love.DrawMode # How to draw the arc. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. ---@param radius number # Radius of the arc. ---@param angle1 number # The angle at which the arc begins. ---@param angle2 number # The angle at which the arc terminates. ---@param segments number # The number of segments used for drawing the arc. -function love.graphics.arc(drawmode, radius, angle1, angle2, segments) end +function love.graphics.arc(drawmode, x, y, radius, angle1, angle2, segments) end --- ---Creates a screenshot once the current frame is done (after love.draw has finished). @@ -46,8 +48,10 @@ function love.graphics.captureScreenshot(filename) end --- ---@overload fun(mode: love.DrawMode, x: number, y: number, radius: number, segments: number) ---@param mode love.DrawMode # How to draw the circle. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. ---@param radius number # The radius of the circle. -function love.graphics.circle(mode, radius) end +function love.graphics.circle(mode, x, y, radius) end --- ---Clears the screen or active Canvas to the specified color. @@ -94,13 +98,16 @@ function love.graphics.discard(discardcolor, discardstencil) end ---@overload fun(drawable: love.Drawable, transform: love.Transform) ---@overload fun(texture: love.Texture, quad: love.Quad, transform: love.Transform) ---@param drawable love.Drawable # A drawable object. +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function love.graphics.draw(drawable, sx, sy, ox, oy, kx, ky) end +function love.graphics.draw(drawable, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Draws many instances of a Mesh with a single draw call, using hardware geometry instancing. @@ -112,13 +119,16 @@ function love.graphics.draw(drawable, sx, sy, ox, oy, kx, ky) end ---@overload fun(mesh: love.Mesh, instancecount: number, transform: love.Transform) ---@param mesh love.Mesh # The mesh to render. ---@param instancecount number # The number of instances to render. +---@param x number # The position to draw the instances (x-axis). +---@param y number # The position to draw the instances (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function love.graphics.drawInstanced(mesh, instancecount, sx, sy, ox, oy, kx, ky) end +function love.graphics.drawInstanced(mesh, instancecount, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Draws a layer of an Array Texture. @@ -128,22 +138,27 @@ function love.graphics.drawInstanced(mesh, instancecount, sx, sy, ox, oy, kx, ky ---@overload fun(texture: love.Texture, layerindex: number, quad: love.Quad, transform: love.Transform) ---@param texture love.Texture # The Array Texture to draw. ---@param layerindex number # The index of the layer to use when drawing. +---@param x number # The position to draw the texture (x-axis). +---@param y number # The position to draw the texture (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function love.graphics.drawLayer(texture, layerindex, sx, sy, ox, oy, kx, ky) end +function love.graphics.drawLayer(texture, layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Draws an ellipse. --- ---@overload fun(mode: love.DrawMode, x: number, y: number, radiusx: number, radiusy: number, segments: number) ---@param mode love.DrawMode # How to draw the ellipse. +---@param x number # The position of the center along x-axis. +---@param y number # The position of the center along y-axis. ---@param radiusx number # The radius of the ellipse along the x-axis (half the ellipse's width). ---@param radiusy number # The radius of the ellipse along the y-axis (half the ellipse's height). -function love.graphics.ellipse(mode, radiusx, radiusy) end +function love.graphics.ellipse(mode, x, y, radiusx, radiusy) end --- ---Immediately renders any pending automatically batched draws. @@ -161,6 +176,10 @@ function love.graphics.flushBatch() end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). function love.graphics.getBackgroundColor() end --- @@ -188,6 +207,10 @@ function love.graphics.getCanvasFormats() end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). function love.graphics.getColor() end --- @@ -195,6 +218,10 @@ function love.graphics.getColor() end --- ---The color mask determines whether individual components of the colors of drawn objects will affect the color of the screen. They affect love.graphics.clear and Canvas:clear as well. --- +---@return boolean r # Whether the red color component is active when rendering. +---@return boolean g # Whether the green color component is active when rendering. +---@return boolean b # Whether the blue color component is active when rendering. +---@return boolean a # Whether the alpha color component is active when rendering. function love.graphics.getColorMask() end --- @@ -328,6 +355,8 @@ function love.graphics.getRendererInfo() end --- ---Gets the current scissor box. --- +---@return number x # The x-component of the top-left point of the box. +---@return number y # The y-component of the top-left point of the box. ---@return number width # The width of the box. ---@return number height # The height of the box. function love.graphics.getScissor() end @@ -395,9 +424,11 @@ function love.graphics.getWidth() end --- ---The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). --- +---@param x number # The x-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. +---@param y number # The y-coordinate of the upper left corner of the rectangle to intersect with the existing scissor rectangle. ---@param width number # The width of the rectangle to intersect with the existing scissor rectangle. ---@param height number # The height of the rectangle to intersect with the existing scissor rectangle. -function love.graphics.intersectScissor(width, height) end +function love.graphics.intersectScissor(x, y, width, height) end --- ---Converts the given 2D position from screen-space into global coordinates. @@ -581,12 +612,14 @@ function love.graphics.newParticleSystem(image, buffer) end --- ---The purpose of a Quad is to use a fraction of an image to draw objects, as opposed to drawing entire image. It is most useful for sprite sheets and atlases: in a sprite atlas, multiple sprites reside in same image, quad is used to draw a specific sprite from that image; in animated sprites with all frames residing in the same image, quad is used to draw specific frame from the animation. --- +---@param x number # The top-left position in the Image along the x-axis. +---@param y number # The top-left position in the Image along the y-axis. ---@param width number # The width of the Quad in the Image. (Must be greater than 0.) ---@param height number # The height of the Quad in the Image. (Must be greater than 0.) ---@param sw number # The reference width, the width of the Image. (Must be greater than 0.) ---@param sh number # The reference height, the height of the Image. (Must be greater than 0.) ---@return love.Quad quad # The new Quad. -function love.graphics.newQuad(width, height, sw, sh) end +function love.graphics.newQuad(x, y, width, height, sw, sh) end --- ---Creates a new Shader object for hardware-accelerated vertex and pixel effects. A Shader contains either vertex shader code, pixel shader code, or both. @@ -655,7 +688,9 @@ function love.graphics.origin() end --- ---@overload fun(points: table) ---@overload fun(points: table) -function love.graphics.points() end +---@param x number # The position of the first point on the x-axis. +---@param y number # The position of the first point on the y-axis. +function love.graphics.points(x, y) end --- ---Draw a polygon. @@ -695,13 +730,16 @@ function love.graphics.present() end ---@overload fun(text: string, font: love.Font, transform: love.Transform) ---@overload fun(coloredtext: table, font: love.Font, transform: love.Transform) ---@param text string # The text to draw. +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function love.graphics.print(text, sx, sy, ox, oy, kx, ky) end +function love.graphics.print(text, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Draws formatted text, with word wrap and alignment. @@ -722,15 +760,18 @@ function love.graphics.print(text, sx, sy, ox, oy, kx, ky) end ---@overload fun(coloredtext: table, transform: love.Transform, limit: number, align: love.AlignMode) ---@overload fun(coloredtext: table, font: love.Font, transform: love.Transform, limit: number, align: love.AlignMode) ---@param text string # A text string. +---@param x number # The position on the x-axis. +---@param y number # The position on the y-axis. ---@param limit number # Wrap the line after this many horizontal pixels. ---@param align love.AlignMode # The alignment. +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function love.graphics.printf(text, limit, align, sx, sy, ox, oy, kx, ky) end +function love.graphics.printf(text, x, y, limit, align, r, sx, sy, ox, oy, kx, ky) end --- ---Copies and pushes the current coordinate transformation to the transformation stack. @@ -745,9 +786,11 @@ function love.graphics.push() end --- ---@overload fun(mode: love.DrawMode, x: number, y: number, width: number, height: number, rx: number, ry: number, segments: number) ---@param mode love.DrawMode # How to draw the rectangle. +---@param x number # The position of top-left corner along the x-axis. +---@param y number # The position of top-left corner along the y-axis. ---@param width number # Width of the rectangle. ---@param height number # Height of the rectangle. -function love.graphics.rectangle(mode, width, height) end +function love.graphics.rectangle(mode, x, y, width, height) end --- ---Replaces the current coordinate transformation with the given Transform object. @@ -923,9 +966,11 @@ function love.graphics.setPointSize(size) end ---The dimensions of the scissor is unaffected by graphical transformations (translate, scale, ...). --- ---@overload fun() +---@param x number # x coordinate of upper left corner. +---@param y number # y coordinate of upper left corner. ---@param width number # width of clipping rectangle. ---@param height number # height of clipping rectangle. -function love.graphics.setScissor(width, height) end +function love.graphics.setScissor(x, y, width, height) end --- ---Sets or resets a Shader as the current pixel effect or vertex shaders. All drawing operations until the next ''love.graphics.setShader'' will be drawn using the Shader object specified. @@ -1209,8 +1254,10 @@ function Image:isCompressed() end ---@param data love.ImageData # The new ImageData to replace the contents with. ---@param slice number # Which cubemap face, array index, or volume layer to replace, if applicable. ---@param mipmap number # The mimap level to replace, if the Image has mipmaps. +---@param x number # The x-offset in pixels from the top-left of the image to replace. The given ImageData's width plus this value must not be greater than the pixel width of the Image's specified mipmap level. +---@param y number # The y-offset in pixels from the top-left of the image to replace. The given ImageData's height plus this value must not be greater than the pixel height of the Image's specified mipmap level. ---@param reloadmipmaps boolean # Whether to generate new mipmaps after replacing the Image's pixels. True by default if the Image was created with automatically generated mipmaps, false by default otherwise. -function Image:replacePixels(data, slice, mipmap, reloadmipmaps) end +function Image:replacePixels(data, slice, mipmap, x, y, reloadmipmaps) end --- ---A 2D polygon mesh used for drawing arbitrary textured shapes. @@ -1492,6 +1539,8 @@ function ParticleSystem:getParticleLifetime() end --- ---Gets the position of the emitter. --- +---@return number x # Position along x-axis. +---@return number y # Position along y-axis. function ParticleSystem:getPosition() end --- @@ -1595,7 +1644,9 @@ function ParticleSystem:isStopped() end --- ---Moves the position of the emitter. This results in smoother particle spawning behaviour than if ParticleSystem:setPosition is used every frame. --- -function ParticleSystem:moveTo() end +---@param x number # Position along x-axis. +---@param y number # Position along y-axis. +function ParticleSystem:moveTo(x, y) end --- ---Pauses the particle emitter. @@ -1691,7 +1742,9 @@ function ParticleSystem:setLinearDamping(min, max) end --- ---If this function is not used, the particles rotate around their center. --- -function ParticleSystem:setOffset() end +---@param x number # The x coordinate of the rotation offset. +---@param y number # The y coordinate of the rotation offset. +function ParticleSystem:setOffset(x, y) end --- ---Sets the lifetime of the particles. @@ -1703,7 +1756,9 @@ function ParticleSystem:setParticleLifetime(min, max) end --- ---Sets the position of the emitter. --- -function ParticleSystem:setPosition() end +---@param x number # Position along x-axis. +---@param y number # Position along y-axis. +function ParticleSystem:setPosition(x, y) end --- ---Sets a series of Quads to use for the particle sprites. Particles will choose a Quad from the list based on the particle's current lifetime, allowing for the use of animated sprite sheets with ParticleSystems. @@ -1822,14 +1877,22 @@ function Quad:getTextureDimensions() end --- ---Gets the current viewport of this Quad. --- +---@return number x # The top-left corner along the x-axis. +---@return number y # The top-left corner along the y-axis. +---@return number w # The width of the viewport. +---@return number h # The height of the viewport. function Quad:getViewport() end --- ---Sets the texture coordinates according to a viewport. --- +---@param x number # The top-left corner along the x-axis. +---@param y number # The top-left corner along the y-axis. +---@param w number # The width of the viewport. +---@param h number # The height of the viewport. ---@param sw number # The reference width, the width of the Image. (Must be greater than 0.) ---@param sh number # The reference height, the height of the Image. (Must be greater than 0.) -function Quad:setViewport(sw, sh) end +function Quad:setViewport(x, y, w, h, sw, sh) end --- ---A Shader is used for advanced hardware-accelerated pixel or vertex manipulation. These effects are written in a language based on GLSL (OpenGL Shading Language) with a few things simplified for easier coding. @@ -1917,6 +1980,9 @@ local SpriteBatch = {} ---Adds a sprite to the batch. Sprites are drawn in the order they are added. --- ---@overload fun(quad: love.Quad, x: number, y: number, r: number, sx: number, sy: number, ox: number, oy: number, kx: number, ky: number):number +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). @@ -1924,7 +1990,7 @@ local SpriteBatch = {} ---@param kx number # Shear factor (x-axis). ---@param ky number # Shear factor (y-axis). ---@return number id # An identifier for the added sprite. -function SpriteBatch:add(sx, sy, ox, oy, kx, ky) end +function SpriteBatch:add(x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Adds a sprite to a batch created with an Array Texture. @@ -1933,6 +1999,9 @@ function SpriteBatch:add(sx, sy, ox, oy, kx, ky) end ---@overload fun(layerindex: number, transform: love.Transform):number ---@overload fun(layerindex: number, quad: love.Quad, transform: love.Transform):number ---@param layerindex number # The index of the layer to use for this sprite. +---@param x number # The position to draw the sprite (x-axis). +---@param y number # The position to draw the sprite (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). @@ -1940,7 +2009,7 @@ function SpriteBatch:add(sx, sy, ox, oy, kx, ky) end ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). ---@return number spriteindex # The index of the added sprite, for use with SpriteBatch:set or SpriteBatch:setLayer. -function SpriteBatch:addLayer(layerindex, sx, sy, ox, oy, kx, ky) end +function SpriteBatch:addLayer(layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Attaches a per-vertex attribute from a Mesh onto this SpriteBatch, for use when drawing. This can be combined with a Shader to augment a SpriteBatch with per-vertex or additional per-sprite information instead of just having per-sprite colors. @@ -1978,6 +2047,10 @@ function SpriteBatch:getBufferSize() end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). function SpriteBatch:getColor() end --- @@ -1997,13 +2070,16 @@ function SpriteBatch:getTexture() end --- ---@overload fun(spriteindex: number, quad: love.Quad, x: number, y: number, r: number, sx: number, sy: number, ox: number, oy: number, kx: number, ky: number) ---@param spriteindex number # The index of the sprite that will be changed. +---@param x number # The position to draw the object (x-axis). +---@param y number # The position to draw the object (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shear factor (x-axis). ---@param ky number # Shear factor (y-axis). -function SpriteBatch:set(spriteindex, sx, sy, ox, oy, kx, ky) end +function SpriteBatch:set(spriteindex, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Sets the color that will be used for the next add and set operations. Calling the function without arguments will disable all per-sprite colors for the SpriteBatch. @@ -2013,7 +2089,11 @@ function SpriteBatch:set(spriteindex, sx, sy, ox, oy, kx, ky) end ---In version 0.9.2 and older, the global color set with love.graphics.setColor will not work on the SpriteBatch if any of the sprites has its own color. --- ---@overload fun() -function SpriteBatch:setColor() end +---@param r number # The amount of red. +---@param g number # The amount of green. +---@param b number # The amount of blue. +---@param a number # The amount of alpha. +function SpriteBatch:setColor(r, g, b, a) end --- ---Restricts the drawn sprites in the SpriteBatch to a subset of the total. @@ -2031,13 +2111,16 @@ function SpriteBatch:setDrawRange(start, count) end ---@overload fun(spriteindex: number, layerindex: number, quad: love.Quad, transform: love.Transform) ---@param spriteindex number # The index of the existing sprite to replace. ---@param layerindex number # The index of the layer in the Array Texture to use for this sprite. +---@param x number # The position to draw the sprite (x-axis). +---@param y number # The position to draw the sprite (y-axis). +---@param r number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). ---@param ox number # Origin offset (x-axis). ---@param oy number # Origin offset (y-axis). ---@param kx number # Shearing factor (x-axis). ---@param ky number # Shearing factor (y-axis). -function SpriteBatch:setLayer(spriteindex, layerindex, sx, sy, ox, oy, kx, ky) end +function SpriteBatch:setLayer(spriteindex, layerindex, x, y, r, sx, sy, ox, oy, kx, ky) end --- ---Sets the texture (Image or Canvas) used for the sprites in the batch, when drawing. @@ -2056,6 +2139,8 @@ local Text = {} --- ---@overload fun(coloredtext: table, x: number, y: number, angle: number, sx: number, sy: number, ox: number, oy: number, kx: number, ky: number):number ---@param textstring string # The text to add to the object. +---@param x number # The position of the new text on the x-axis. +---@param y number # The position of the new text on the y-axis. ---@param angle number # The orientation of the new text in radians. ---@param sx number # Scale factor on the x-axis. ---@param sy number # Scale factor on the y-axis. @@ -2064,7 +2149,7 @@ local Text = {} ---@param kx number # Shearing / skew factor on the x-axis. ---@param ky number # Shearing / skew factor on the y-axis. ---@return number index # An index number that can be used with Text:getWidth or Text:getHeight. -function Text:add(textstring, angle, sx, sy, ox, oy, kx, ky) end +function Text:add(textstring, x, y, angle, sx, sy, ox, oy, kx, ky) end --- ---Adds additional formatted / colored text to the Text object at the specified position. @@ -2075,6 +2160,8 @@ function Text:add(textstring, angle, sx, sy, ox, oy, kx, ky) end ---@param textstring string # The text to add to the object. ---@param wraplimit number # The maximum width in pixels of the text before it gets automatically wrapped to a new line. ---@param align love.AlignMode # The alignment of the text. +---@param x number # The position of the new text (x-axis). +---@param y number # The position of the new text (y-axis). ---@param angle number # Orientation (radians). ---@param sx number # Scale factor (x-axis). ---@param sy number # Scale factor (y-axis). @@ -2083,7 +2170,7 @@ function Text:add(textstring, angle, sx, sy, ox, oy, kx, ky) end ---@param kx number # Shearing / skew factor (x-axis). ---@param ky number # Shearing / skew factor (y-axis). ---@return number index # An index number that can be used with Text:getWidth or Text:getHeight. -function Text:addf(textstring, wraplimit, align, angle, sx, sy, ox, oy, kx, ky) end +function Text:addf(textstring, wraplimit, align, x, y, angle, sx, sy, ox, oy, kx, ky) end --- ---Clears the contents of the Text object. diff --git a/meta/3rd/love2d/library/love.image.lua b/meta/3rd/love2d/library/love.image.lua index 85070b9c..65badbc1 100644 --- a/meta/3rd/love2d/library/love.image.lua +++ b/meta/3rd/love2d/library/love.image.lua @@ -116,7 +116,13 @@ function ImageData:getHeight() end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- -function ImageData:getPixel() end +---@param x number # The position of the pixel on the x-axis. +---@param y number # The position of the pixel on the y-axis. +---@return number r # The red component (0-1). +---@return number g # The green component (0-1). +---@return number b # The blue component (0-1). +---@return number a # The alpha component (0-1). +function ImageData:getPixel(x, y) end --- ---Gets the width of the ImageData in pixels. @@ -146,9 +152,11 @@ function ImageData:getWidth() end ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- ---@param pixelFunction function # Function to apply to every pixel. +---@param x number # The x-axis of the top-left corner of the area within the ImageData to apply the function to. +---@param y number # The y-axis of the top-left corner of the area within the ImageData to apply the function to. ---@param width number # The width of the area within the ImageData to apply the function to. ---@param height number # The height of the area within the ImageData to apply the function to. -function ImageData:mapPixel(pixelFunction, width, height) end +function ImageData:mapPixel(pixelFunction, x, y, width, height) end --- ---Paste into ImageData from another source ImageData. @@ -169,7 +177,13 @@ function ImageData:paste(source, dx, dy, sx, sy, sw, sh) end --- ---In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1. --- -function ImageData:setPixel() end +---@param x number # The position of the pixel on the x-axis. +---@param y number # The position of the pixel on the y-axis. +---@param r number # The red component (0-1). +---@param g number # The green component (0-1). +---@param b number # The blue component (0-1). +---@param a number # The alpha component (0-1). +function ImageData:setPixel(x, y, r, g, b, a) end --- ---Compressed image data formats. Here and here are a couple overviews of many of the formats. diff --git a/meta/3rd/love2d/library/love.lua b/meta/3rd/love2d/library/love.lua index ed26afad..c5897608 100644 --- a/meta/3rd/love2d/library/love.lua +++ b/meta/3rd/love2d/library/love.lua @@ -99,6 +99,7 @@ function Object:type() end ---Checks whether an object is of a certain type. If the object has the type with the specified name in its hierarchy, this function will return true. --- ---@param name string # The name of the type to check for. +---@return boolean b # True if the object is of the specified type, false otherwise. function Object:typeOf(name) end --- diff --git a/meta/3rd/love2d/library/love.math.lua b/meta/3rd/love2d/library/love.math.lua index 2cc07c15..87d73bfb 100644 --- a/meta/3rd/love2d/library/love.math.lua +++ b/meta/3rd/love2d/library/love.math.lua @@ -13,16 +13,24 @@ love.math = {} ---@param gb number # Green color component in 0..255 range. ---@param bb number # Blue color component in 0..255 range. ---@param ab number # Alpha color component in 0..255 range. +---@return number r # Red color component in 0..1 range. +---@return number g # Green color component in 0..1 range. +---@return number b # Blue color component in 0..1 range. +---@return number a # Alpha color component in 0..1 range or nil if alpha is not specified. function love.math.colorFromBytes(rb, gb, bb, ab) end --- ---Converts a color from 0..1 to 0..255 range. --- +---@param r number # Red color component. +---@param g number # Green color component. +---@param b number # Blue color component. +---@param a number # Alpha color component. ---@return number rb # Red color component in 0..255 range. ---@return number gb # Green color component in 0..255 range. ---@return number bb # Blue color component in 0..255 range. ---@return number ab # Alpha color component in 0..255 range or nil if alpha is not specified. -function love.math.colorToBytes() end +function love.math.colorToBytes(r, g, b, a) end --- ---Compresses a string or data using a specific compression algorithm. @@ -52,10 +60,13 @@ function love.math.decompress(compressedData) end --- ---@overload fun(color: table):number, number, number ---@overload fun(c: number):number +---@param r number # The red channel of the sRGB color to convert. +---@param g number # The green channel of the sRGB color to convert. +---@param b number # The blue channel of the sRGB color to convert. ---@return number lr # The red channel of the converted color in linear RGB space. ---@return number lg # The green channel of the converted color in linear RGB space. ---@return number lb # The blue channel of the converted color in linear RGB space. -function love.math.gammaToLinear() end +function love.math.gammaToLinear(r, g, b) end --- ---Gets the seed of the random number generator. @@ -138,8 +149,9 @@ function love.math.newTransform() end ---@overload fun(x: number, y: number):number ---@overload fun(x: number, y: number, z: number):number ---@overload fun(x: number, y: number, z: number, w: number):number +---@param x number # The number used to generate the noise value. ---@return number value # The noise value in the range of 1. -function love.math.noise() end +function love.math.noise(x) end --- ---Generates a pseudo-random number in a platform independent manner. The default love.run seeds this function at startup, so you generally don't need to seed it yourself. @@ -193,12 +205,18 @@ local BezierCurve = {} --- ---This function can be used to move objects along paths or tween parameters. However it should not be used to render the curve, see BezierCurve:render for that purpose. --- -function BezierCurve:evaluate() end +---@param t number # Where to evaluate the curve. +---@return number x # x coordinate of the curve at parameter t. +---@return number y # y coordinate of the curve at parameter t. +function BezierCurve:evaluate(t) end --- ---Get coordinates of the i-th control point. Indices start with 1. --- -function BezierCurve:getControlPoint() end +---@param i number # Index of the control point. +---@return number x # Position of the control point along the x axis. +---@return number y # Position of the control point along the y axis. +function BezierCurve:getControlPoint(i) end --- ---Get the number of control points in the Bézier curve. @@ -231,7 +249,10 @@ function BezierCurve:getSegment(startpoint, endpoint) end --- ---Insert control point as the new i-th control point. Existing control points from i onwards are pushed back by 1. Indices start with 1. Negative indices wrap around: -1 is the last control point, -2 the one before the last, etc. --- -function BezierCurve:insertControlPoint() end +---@param x number # Position of the control point along the x axis. +---@param y number # Position of the control point along the y axis. +---@param i number # Index of the control point. +function BezierCurve:insertControlPoint(x, y, i) end --- ---Removes the specified control point. @@ -274,14 +295,18 @@ function BezierCurve:rotate(angle, ox, oy) end --- ---Scale the Bézier curve by a factor. --- +---@param s number # Scale factor. ---@param ox number # X coordinate of the scaling center. ---@param oy number # Y coordinate of the scaling center. -function BezierCurve:scale(ox, oy) end +function BezierCurve:scale(s, ox, oy) end --- ---Set coordinates of the i-th control point. Indices start with 1. --- -function BezierCurve:setControlPoint() end +---@param i number # Index of the control point. +---@param x number # Position of the control point along the x axis. +---@param y number # Position of the control point along the y axis. +function BezierCurve:setControlPoint(i, x, y) end --- ---Move the Bézier curve by an offset. @@ -436,6 +461,8 @@ function Transform:setMatrix(e1_1, e1_2, e4_4) end --- ---Resets the Transform to the specified transformation parameters. --- +---@param x number # The position of the Transform on the x-axis. +---@param y number # The position of the Transform on the y-axis. ---@param angle number # The orientation of the Transform in radians. ---@param sx number # Scale factor on the x-axis. ---@param sy number # Scale factor on the y-axis. @@ -444,7 +471,7 @@ function Transform:setMatrix(e1_1, e1_2, e4_4) end ---@param kx number # Shearing / skew factor on the x-axis. ---@param ky number # Shearing / skew factor on the y-axis. ---@return love.Transform transform # The Transform object the method was called on. Allows easily chaining Transform methods. -function Transform:setTransformation(angle, sx, sy, ox, oy, kx, ky) end +function Transform:setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky) end --- ---Applies a shear factor (skew) to the Transform's coordinate system. This method does not reset any previously applied transformations. diff --git a/meta/3rd/love2d/library/love.mouse.lua b/meta/3rd/love2d/library/love.mouse.lua index d25808ba..af2eeae5 100644 --- a/meta/3rd/love2d/library/love.mouse.lua +++ b/meta/3rd/love2d/library/love.mouse.lua @@ -15,6 +15,8 @@ function love.mouse.getCursor() end --- ---Returns the current position of the mouse. --- +---@return number x # The position of the mouse along the x-axis. +---@return number y # The position of the mouse along the y-axis. function love.mouse.getPosition() end --- @@ -39,11 +41,13 @@ function love.mouse.getSystemCursor(ctype) end --- ---Returns the current x-position of the mouse. --- +---@return number x # The position of the mouse along the x-axis. function love.mouse.getX() end --- ---Returns the current y-position of the mouse. --- +---@return number y # The position of the mouse along the y-axis. function love.mouse.getY() end --- @@ -106,7 +110,9 @@ function love.mouse.setGrabbed(grab) end --- ---Sets the current position of the mouse. Non-integer values are floored. --- -function love.mouse.setPosition() end +---@param x number # The new position of the mouse along the x-axis. +---@param y number # The new position of the mouse along the y-axis. +function love.mouse.setPosition(x, y) end --- ---Sets whether relative mode is enabled for the mouse. @@ -129,14 +135,16 @@ function love.mouse.setVisible(visible) end --- ---Non-integer values are floored. --- -function love.mouse.setX() end +---@param x number # The new position of the mouse along the x-axis. +function love.mouse.setX(x) end --- ---Sets the current Y position of the mouse. --- ---Non-integer values are floored. --- -function love.mouse.setY() end +---@param y number # The new position of the mouse along the y-axis. +function love.mouse.setY(y) end --- ---Represents a hardware cursor. diff --git a/meta/3rd/love2d/library/love.physics.lua b/meta/3rd/love2d/library/love.physics.lua index 5c382108..df2d9e39 100644 --- a/meta/3rd/love2d/library/love.physics.lua +++ b/meta/3rd/love2d/library/love.physics.lua @@ -42,9 +42,11 @@ function love.physics.getMeter() end ---The mass of the body gets calculated when a Fixture is attached or removed, but can be changed at any time with Body:setMass or Body:resetMassData. --- ---@param world love.World # The world to create the body in. +---@param x number # The x position of the body. +---@param y number # The y position of the body. ---@param type love.BodyType # The type of the body. ---@return love.Body body # A new body. -function love.physics.newBody(world, type) end +function love.physics.newBody(world, x, y, type) end --- ---Creates a new ChainShape. @@ -108,9 +110,11 @@ function love.physics.newFixture(body, shape, density) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean):love.FrictionJoint ---@param body1 love.Body # The first body to attach to the joint. ---@param body2 love.Body # The second body to attach to the joint. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. ---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. ---@return love.FrictionJoint joint # The new FrictionJoint. -function love.physics.newFrictionJoint(body1, body2, collideConnected) end +function love.physics.newFrictionJoint(body1, body2, x, y, collideConnected) end --- ---Create a GearJoint connecting two Joints. @@ -146,8 +150,10 @@ function love.physics.newMotorJoint(body1, body2, correctionFactor) end ---The advantage of using a MouseJoint instead of just changing a body position directly is that collisions and reactions to other joints are handled by the physics engine. --- ---@param body love.Body # The body to attach to the mouse. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. ---@return love.MouseJoint joint # The new mouse joint. -function love.physics.newMouseJoint(body) end +function love.physics.newMouseJoint(body, x, y) end --- ---Creates a new PolygonShape. @@ -173,11 +179,13 @@ function love.physics.newPolygonShape(x1, y1, x2, y2, x3, y3) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, ax: number, ay: number, collideConnected: boolean, referenceAngle: number):love.PrismaticJoint ---@param body1 love.Body # The first body to connect with a prismatic joint. ---@param body2 love.Body # The second body to connect with a prismatic joint. +---@param x number # The x coordinate of the anchor point. +---@param y number # The y coordinate of the anchor point. ---@param ax number # The x coordinate of the axis vector. ---@param ay number # The y coordinate of the axis vector. ---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. ---@return love.PrismaticJoint joint # The new prismatic joint. -function love.physics.newPrismaticJoint(body1, body2, ax, ay, collideConnected) end +function love.physics.newPrismaticJoint(body1, body2, x, y, ax, ay, collideConnected) end --- ---Creates a PulleyJoint to join two bodies to each other and the ground. @@ -220,9 +228,11 @@ function love.physics.newRectangleShape(width, height) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean, referenceAngle: number):love.RevoluteJoint ---@param body1 love.Body # The first body. ---@param body2 love.Body # The second body. +---@param x number # The x position of the connecting point. +---@param y number # The y position of the connecting point. ---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. ---@return love.RevoluteJoint joint # The new revolute joint. -function love.physics.newRevoluteJoint(body1, body2, collideConnected) end +function love.physics.newRevoluteJoint(body1, body2, x, y, collideConnected) end --- ---Creates a joint between two bodies. Its only function is enforcing a max distance between these bodies. @@ -245,9 +255,11 @@ function love.physics.newRopeJoint(body1, body2, x1, y1, x2, y2, maxLength, coll ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, collideConnected: boolean, referenceAngle: number):love.WeldJoint ---@param body1 love.Body # The first body to attach to the joint. ---@param body2 love.Body # The second body to attach to the joint. +---@param x number # The x position of the anchor point (world space). +---@param y number # The y position of the anchor point (world space). ---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. ---@return love.WeldJoint joint # The new WeldJoint. -function love.physics.newWeldJoint(body1, body2, collideConnected) end +function love.physics.newWeldJoint(body1, body2, x, y, collideConnected) end --- ---Creates a wheel joint. @@ -255,11 +267,13 @@ function love.physics.newWeldJoint(body1, body2, collideConnected) end ---@overload fun(body1: love.Body, body2: love.Body, x1: number, y1: number, x2: number, y2: number, ax: number, ay: number, collideConnected: boolean):love.WheelJoint ---@param body1 love.Body # The first body. ---@param body2 love.Body # The second body. +---@param x number # The x position of the anchor point. +---@param y number # The y position of the anchor point. ---@param ax number # The x position of the axis unit vector. ---@param ay number # The y position of the axis unit vector. ---@param collideConnected boolean # Specifies whether the two bodies should collide with each other. ---@return love.WheelJoint joint # The new WheelJoint. -function love.physics.newWheelJoint(body1, body2, ax, ay, collideConnected) end +function love.physics.newWheelJoint(body1, body2, x, y, ax, ay, collideConnected) end --- ---Creates a new World. @@ -370,6 +384,7 @@ function Body:getAngularDamping() end --- ---If you need the ''rate of change of position over time'', use Body:getLinearVelocity. --- +---@return number w # The angular velocity in radians/second. function Body:getAngularVelocity() end --- @@ -429,6 +444,8 @@ function Body:getLinearDamping() end --- ---See page 136 of 'Essential Mathematics for Games and Interactive Applications' for definitions of local and world coordinates. --- +---@return number x # The x-component of the velocity vector +---@return number y # The y-component of the velocity vector function Body:getLinearVelocity() end --- @@ -438,9 +455,11 @@ function Body:getLinearVelocity() end --- ---The point on the body must given in local coordinates. Use Body:getLinearVelocityFromWorldPoint to specify this with world coordinates. --- +---@param x number # The x position to measure velocity. +---@param y number # The y position to measure velocity. ---@return number vx # The x component of velocity at point (x,y). ---@return number vy # The y component of velocity at point (x,y). -function Body:getLinearVelocityFromLocalPoint() end +function Body:getLinearVelocityFromLocalPoint(x, y) end --- ---Get the linear velocity of a point on the body. @@ -449,15 +468,19 @@ function Body:getLinearVelocityFromLocalPoint() end --- ---The point on the body must given in world coordinates. Use Body:getLinearVelocityFromLocalPoint to specify this with local coordinates. --- +---@param x number # The x position to measure velocity. +---@param y number # The y position to measure velocity. ---@return number vx # The x component of velocity at point (x,y). ---@return number vy # The y component of velocity at point (x,y). -function Body:getLinearVelocityFromWorldPoint() end +function Body:getLinearVelocityFromWorldPoint(x, y) end --- ---Get the center of mass position in local coordinates. --- ---Use Body:getWorldCenter to get the center of mass in world coordinates. --- +---@return number x # The x coordinate of the center of mass. +---@return number y # The y coordinate of the center of mass. function Body:getLocalCenter() end --- @@ -489,6 +512,8 @@ function Body:getMass() end --- ---Returns the mass, its center, and the rotational inertia. --- +---@return number x # The x position of the center of mass. +---@return number y # The y position of the center of mass. ---@return number mass # The mass of the body. ---@return number inertia # The rotational inertia. function Body:getMassData() end @@ -498,6 +523,8 @@ function Body:getMassData() end --- ---Note that this may not be the center of mass of the body. --- +---@return number x # The x position. +---@return number y # The y position. function Body:getPosition() end --- @@ -505,6 +532,8 @@ function Body:getPosition() end --- ---Note that the position may not be the center of mass of the body. An angle of 0 radians will mean 'looking to the right'. Although radians increase counter-clockwise, the y axis points down so it becomes clockwise from our point of view. --- +---@return number x # The x component of the position. +---@return number y # The y component of the position. ---@return number angle # The angle in radians. function Body:getTransform() end @@ -531,6 +560,8 @@ function Body:getWorld() end --- ---Use Body:getLocalCenter to get the center of mass in local coordinates. --- +---@return number x # The x coordinate of the center of mass. +---@return number y # The y coordinate of the center of mass. function Body:getWorldCenter() end --- @@ -567,11 +598,13 @@ function Body:getWorldVector(localX, localY) end --- ---Get the x position of the body in world coordinates. --- +---@return number x # The x position in world coordinates. function Body:getX() end --- ---Get the y position of the body in world coordinates. --- +---@return number y # The y position in world coordinates. function Body:getY() end --- @@ -669,7 +702,8 @@ function Body:setAngularDamping(damping) end --- ---This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. --- -function Body:setAngularVelocity() end +---@param w number # The new angular velocity, in radians per second +function Body:setAngularVelocity(w) end --- ---Wakes the body up or puts it to sleep. @@ -728,7 +762,9 @@ function Body:setLinearDamping(ld) end --- ---This function will not accumulate anything; any impulses previously applied since the last call to World:update will be lost. --- -function Body:setLinearVelocity() end +---@param x number # The x-component of the velocity vector. +---@param y number # The y-component of the velocity vector. +function Body:setLinearVelocity(x, y) end --- ---Sets a new body mass. @@ -739,9 +775,11 @@ function Body:setMass(mass) end --- ---Overrides the calculated mass data. --- +---@param x number # The x position of the center of mass. +---@param y number # The y position of the center of mass. ---@param mass number # The mass of the body. ---@param inertia number # The rotational inertia. -function Body:setMassData(mass, inertia) end +function Body:setMassData(x, y, mass, inertia) end --- ---Set the position of the body. @@ -750,7 +788,9 @@ function Body:setMassData(mass, inertia) end --- ---This function cannot wake up the body. --- -function Body:setPosition() end +---@param x number # The x position. +---@param y number # The y position. +function Body:setPosition(x, y) end --- ---Sets the sleeping behaviour of the body. Should sleeping be allowed, a body at rest will automatically sleep. A sleeping body is not simulated unless it collided with an awake body. Be wary that one can end up with a situation like a floating sleeping body if the floor was removed. @@ -765,8 +805,10 @@ function Body:setSleepingAllowed(allowed) end --- ---This function cannot wake up the body. --- +---@param x number # The x component of the position. +---@param y number # The y component of the position. ---@param angle number # The angle in radians. -function Body:setTransform(angle) end +function Body:setTransform(x, y, angle) end --- ---Sets a new body type. @@ -787,14 +829,16 @@ function Body:setUserData(value) end --- ---This function cannot wake up the body. --- -function Body:setX() end +---@param x number # The x position. +function Body:setX(x) end --- ---Set the y position of the body. --- ---This function cannot wake up the body. --- -function Body:setY() end +---@param y number # The y position. +function Body:setY(y) end --- ---A ChainShape consists of multiple line segments. It can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. @@ -816,12 +860,16 @@ function ChainShape:getChildEdge(index) end --- ---Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if ChainShape:setNextVertex hasn't been called. function ChainShape:getNextVertex() end --- ---Returns a point of the shape. --- ---@param index number # The index of the point to return. +---@return number x # The x-coordinate of the point. +---@return number y # The y-coordinate of the point. function ChainShape:getPoint(index) end --- @@ -838,6 +886,8 @@ function ChainShape:getPoints() end --- ---Setting next and previous ChainShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if ChainShape:setPreviousVertex hasn't been called. function ChainShape:getPreviousVertex() end --- @@ -851,14 +901,18 @@ function ChainShape:getVertexCount() end --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function ChainShape:setNextVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function ChainShape:setNextVertex(x, y) end --- ---Sets a vertex that establishes a connection to the previous shape. --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function ChainShape:setPreviousVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function ChainShape:setPreviousVertex(x, y) end --- ---Circle extends Shape and adds a radius and a local position. @@ -869,6 +923,8 @@ local CircleShape = {} --- ---Gets the center point of the circle shape. --- +---@return number x # The x-component of the center point of the circle. +---@return number y # The y-component of the center point of the circle. function CircleShape:getPoint() end --- @@ -880,7 +936,9 @@ function CircleShape:getRadius() end --- ---Sets the location of the center of the circle shape. --- -function CircleShape:setPoint() end +---@param x number # The x-component of the new center point of the circle. +---@param y number # The y-component of the new center point of the circle. +function CircleShape:setPoint(x, y) end --- ---Sets the radius of the circle. @@ -992,6 +1050,7 @@ function DistanceJoint:getFrequency() end --- ---Gets the equilibrium distance between the two Bodies. --- +---@return number l # The length between the two Bodies. function DistanceJoint:getLength() end --- @@ -1009,7 +1068,8 @@ function DistanceJoint:setFrequency(Hz) end --- ---Sets the equilibrium distance between the two Bodies. --- -function DistanceJoint:setLength() end +---@param l number # The length between the two Bodies. +function DistanceJoint:setLength(l) end --- ---A EdgeShape is a line segment. They can be used to create the boundaries of your terrain. The shape does not have volume and can only collide with PolygonShape and CircleShape. @@ -1022,6 +1082,8 @@ local EdgeShape = {} --- ---Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if EdgeShape:setNextVertex hasn't been called. function EdgeShape:getNextVertex() end --- @@ -1038,6 +1100,8 @@ function EdgeShape:getPoints() end --- ---Setting next and previous EdgeShape vertices can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- +---@return number x # The x-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called. +---@return number y # The y-component of the vertex, or nil if EdgeShape:setPreviousVertex hasn't been called. function EdgeShape:getPreviousVertex() end --- @@ -1045,14 +1109,18 @@ function EdgeShape:getPreviousVertex() end --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function EdgeShape:setNextVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function EdgeShape:setNextVertex(x, y) end --- ---Sets a vertex that establishes a connection to the previous shape. --- ---This can help prevent unwanted collisions when a flat shape slides along the edge and moves over to the new shape. --- -function EdgeShape:setPreviousVertex() end +---@param x number # The x-component of the vertex. +---@param y number # The y-component of the vertex. +function EdgeShape:setPreviousVertex(x, y) end --- ---Fixtures attach shapes to bodies. @@ -1128,6 +1196,8 @@ function Fixture:getMask() end --- ---Returns the mass, its center and the rotational inertia. --- +---@return number x # The x position of the center of mass. +---@return number y # The y position of the center of mass. ---@return number mass # The mass of the fixture. ---@return number inertia # The rotational inertia. function Fixture:getMassData() end @@ -1267,8 +1337,10 @@ function Fixture:setUserData(value) end --- ---Checks if a point is inside the shape of the fixture. --- +---@param x number # The x position of the point. +---@param y number # The y position of the point. ---@return boolean isInside # True if the point is inside or false if it is outside. -function Fixture:testPoint() end +function Fixture:testPoint(x, y) end --- ---A FrictionJoint applies friction to a body. @@ -1359,12 +1431,16 @@ function Joint:getBodies() end --- ---Gets whether the connected Bodies collide. --- +---@return boolean c # True if they collide, false otherwise. function Joint:getCollideConnected() end --- ---Returns the reaction force in newtons on the second body --- -function Joint:getReactionForce() end +---@param x number # How long the force applies. Usually the inverse time step or 1/dt. +---@return number x # The x-component of the force. +---@return number y # The y-component of the force. +function Joint:getReactionForce(x) end --- ---Returns the reaction torque on the second body. @@ -1414,6 +1490,8 @@ function MotorJoint:getAngularOffset() end --- ---Gets the target linear offset between the two Bodies the Joint is attached to. --- +---@return number x # The x component of the target linear offset, relative to the first Body. +---@return number y # The y component of the target linear offset, relative to the first Body. function MotorJoint:getLinearOffset() end --- @@ -1425,7 +1503,9 @@ function MotorJoint:setAngularOffset(angleoffset) end --- ---Sets the target linear offset between the two Bodies the Joint is attached to. --- -function MotorJoint:setLinearOffset() end +---@param x number # The x component of the target linear offset, relative to the first Body. +---@param y number # The y component of the target linear offset, relative to the first Body. +function MotorJoint:setLinearOffset(x, y) end --- ---For controlling objects with the mouse. @@ -1448,11 +1528,14 @@ function MouseJoint:getFrequency() end --- ---Gets the highest allowed force. --- +---@return number f # The max allowed force. function MouseJoint:getMaxForce() end --- ---Gets the target point. --- +---@return number x # The x-component of the target. +---@return number y # The x-component of the target. function MouseJoint:getTarget() end --- @@ -1470,12 +1553,15 @@ function MouseJoint:setFrequency(freq) end --- ---Sets the highest allowed force. --- -function MouseJoint:setMaxForce() end +---@param f number # The max allowed force. +function MouseJoint:setMaxForce(f) end --- ---Sets the target point. --- -function MouseJoint:setTarget() end +---@param x number # The x-component of the target. +---@param y number # The y-component of the target. +function MouseJoint:setTarget(x, y) end --- ---A PolygonShape is a convex polygon with up to 8 vertices. @@ -1509,16 +1595,20 @@ function PrismaticJoint:areLimitsEnabled() end --- ---Gets the world-space axis vector of the Prismatic Joint. --- +---@return number x # The x-axis coordinate of the world-space axis vector. +---@return number y # The y-axis coordinate of the world-space axis vector. function PrismaticJoint:getAxis() end --- ---Get the current joint angle speed. --- +---@return number s # Joint angle speed in meters/second. function PrismaticJoint:getJointSpeed() end --- ---Get the current joint translation. --- +---@return number t # Joint translation, usually in meters.. function PrismaticJoint:getJointTranslation() end --- @@ -1537,6 +1627,7 @@ function PrismaticJoint:getLowerLimit() end --- ---Gets the maximum motor force. --- +---@return number f # The maximum motor force, usually in N. function PrismaticJoint:getMaxMotorForce() end --- @@ -1549,6 +1640,7 @@ function PrismaticJoint:getMotorForce(invdt) end --- ---Gets the motor speed. --- +---@return number s # The motor speed, usually in meters per second. function PrismaticJoint:getMotorSpeed() end --- @@ -1585,7 +1677,8 @@ function PrismaticJoint:setLowerLimit(lower) end --- ---Set the maximum motor force. --- -function PrismaticJoint:setMaxMotorForce() end +---@param f number # The maximum motor force, usually in N. +function PrismaticJoint:setMaxMotorForce(f) end --- ---Enables/disables the joint motor. @@ -1596,7 +1689,8 @@ function PrismaticJoint:setMotorEnabled(enable) end --- ---Sets the motor speed. --- -function PrismaticJoint:setMotorSpeed() end +---@param s number # The motor speed, usually in meters per second. +function PrismaticJoint:setMotorSpeed(s) end --- ---Sets the upper limit. @@ -1694,6 +1788,7 @@ function RevoluteJoint:getJointAngle() end --- ---Get the current joint angle speed. --- +---@return number s # Joint angle speed in radians/second. function RevoluteJoint:getJointSpeed() end --- @@ -1712,16 +1807,19 @@ function RevoluteJoint:getLowerLimit() end --- ---Gets the maximum motor force. --- +---@return number f # The maximum motor force, in Nm. function RevoluteJoint:getMaxMotorTorque() end --- ---Gets the motor speed. --- +---@return number s # The motor speed, radians per second. function RevoluteJoint:getMotorSpeed() end --- ---Get the current motor force. --- +---@return number f # The current motor force, in Nm. function RevoluteJoint:getMotorTorque() end --- @@ -1764,7 +1862,8 @@ function RevoluteJoint:setLowerLimit(lower) end --- ---Set the maximum motor force. --- -function RevoluteJoint:setMaxMotorTorque() end +---@param f number # The maximum motor force, in Nm. +function RevoluteJoint:setMaxMotorTorque(f) end --- ---Enables/disables the joint motor. @@ -1775,7 +1874,8 @@ function RevoluteJoint:setMotorEnabled(enable) end --- ---Sets the motor speed. --- -function RevoluteJoint:setMotorSpeed() end +---@param s number # The motor speed, radians per second. +function RevoluteJoint:setMotorSpeed(s) end --- ---Sets the upper limit. @@ -1828,6 +1928,8 @@ function Shape:computeAABB(tx, ty, tr, childIndex) end ---Computes the mass properties for the shape with the specified density. --- ---@param density number # The shape density. +---@return number x # The x postition of the center of mass. +---@return number y # The y postition of the center of mass. ---@return number mass # The mass of the shape. ---@return number inertia # The rotational inertia. function Shape:computeMass(density) end @@ -1883,8 +1985,10 @@ function Shape:rayCast(x1, y1, x2, y2, maxFraction, tx, ty, tr, childIndex) end ---@param tx number # Translates the shape along the x-axis. ---@param ty number # Translates the shape along the y-axis. ---@param tr number # Rotates the shape. +---@param x number # The x-component of the point. +---@param y number # The y-component of the point. ---@return boolean hit # True if inside, false if outside -function Shape:testPoint(tx, ty, tr) end +function Shape:testPoint(tx, ty, tr, x, y) end --- ---A WeldJoint essentially glues two bodies together. @@ -1925,6 +2029,8 @@ local WheelJoint = {} --- ---Gets the world-space axis vector of the Wheel Joint. --- +---@return number x # The x-axis coordinate of the world-space axis vector. +---@return number y # The y-axis coordinate of the world-space axis vector. function WheelJoint:getAxis() end --- @@ -2022,6 +2128,7 @@ function World:getBodies() end --- ---Returns the number of bodies in the world. --- +---@return number n # The number of bodies in the world. function World:getBodyCount() end --- @@ -2036,6 +2143,7 @@ function World:getCallbacks() end --- ---Returns the number of contacts in the world. --- +---@return number n # The number of contacts in the world. function World:getContactCount() end --- @@ -2053,11 +2161,14 @@ function World:getContacts() end --- ---Get the gravity of the world. --- +---@return number x # The x component of gravity. +---@return number y # The y component of gravity. function World:getGravity() end --- ---Returns the number of joints in the world. --- +---@return number n # The number of joints in the world. function World:getJointCount() end --- @@ -2100,11 +2211,13 @@ function World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY, ---Casts a ray and calls a function for each fixtures it intersects. --- ---@param fixture love.Fixture # The fixture intersecting the ray. +---@param x number # The x position of the intersection point. +---@param y number # The y position of the intersection point. ---@param xn number # The x value of the surface normal vector of the shape edge. ---@param yn number # The y value of the surface normal vector of the shape edge. ---@param fraction number # The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value). ---@return number control # The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn't happen. -function World:rayCast(fixture, xn, yn, fraction) end +function World:rayCast(fixture, x, y, xn, yn, fraction) end --- ---Sets functions for the collision callbacks during the world update. @@ -2132,7 +2245,9 @@ function World:setContactFilter(filter) end --- ---Set the gravity of the world. --- -function World:setGravity() end +---@param x number # The x component of gravity. +---@param y number # The y component of gravity. +function World:setGravity(x, y) end --- ---Sets the sleep behaviour of the world. @@ -2143,7 +2258,9 @@ function World:setSleepingAllowed(allow) end --- ---Translates the World's origin. Useful in large worlds where floating point precision issues become noticeable at far distances from the origin. --- -function World:translateOrigin() end +---@param x number # The x component of the new origin with respect to the old origin. +---@param y number # The y component of the new origin with respect to the old origin. +function World:translateOrigin(x, y) end --- ---Update the state of the world. diff --git a/meta/3rd/love2d/library/love.sound.lua b/meta/3rd/love2d/library/love.sound.lua index 8e1786e8..32b0a35c 100644 --- a/meta/3rd/love2d/library/love.sound.lua +++ b/meta/3rd/love2d/library/love.sound.lua @@ -95,8 +95,9 @@ function SoundData:getDuration() end ---Gets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. --- ---@overload fun(i: number, channel: number):number +---@param i number # An integer value specifying the position of the sample (starting at 0). ---@return number sample # The normalized samplepoint (range -1.0 to 1.0). -function SoundData:getSample() end +function SoundData:getSample(i) end --- ---Returns the number of samples per channel of the SoundData. @@ -114,5 +115,6 @@ function SoundData:getSampleRate() end ---Sets the value of the sample-point at the specified position. For stereo SoundData objects, the data from the left and right channels are interleaved in that order. --- ---@overload fun(i: number, channel: number, sample: number) +---@param i number # An integer value specifying the position of the sample (starting at 0). ---@param sample number # The normalized samplepoint (range -1.0 to 1.0). -function SoundData:setSample(sample) end +function SoundData:setSample(i, sample) end diff --git a/meta/3rd/love2d/library/love.timer.lua b/meta/3rd/love2d/library/love.timer.lua index c675072d..ad9e9771 100644 --- a/meta/3rd/love2d/library/love.timer.lua +++ b/meta/3rd/love2d/library/love.timer.lua @@ -35,7 +35,8 @@ function love.timer.getTime() end --- ---Pauses the current thread for the specified amount of time. --- -function love.timer.sleep() end +---@param s number # Seconds to sleep for. +function love.timer.sleep(s) end --- ---Measures the time between two frames. diff --git a/meta/3rd/love2d/library/love.touch.lua b/meta/3rd/love2d/library/love.touch.lua index e36744e3..793eb5ac 100644 --- a/meta/3rd/love2d/library/love.touch.lua +++ b/meta/3rd/love2d/library/love.touch.lua @@ -10,6 +10,8 @@ love.touch = {} ---Gets the current position of the specified touch-press, in pixels. --- ---@param id lightuserdata # The identifier of the touch-press. Use love.touch.getTouches, love.touchpressed, or love.touchmoved to obtain touch id values. +---@return number x # The position along the x-axis of the touch-press inside the window, in pixels. +---@return number y # The position along the y-axis of the touch-press inside the window, in pixels. function love.touch.getPosition(id) end --- diff --git a/meta/3rd/love2d/library/love.window.lua b/meta/3rd/love2d/library/love.window.lua index beff6623..798fc3d5 100644 --- a/meta/3rd/love2d/library/love.window.lua +++ b/meta/3rd/love2d/library/love.window.lua @@ -98,12 +98,18 @@ function love.window.getMode() end --- ---The window position is in the coordinate space of the display it is currently in. --- +---@return number x # The x-coordinate of the window's position. +---@return number y # The y-coordinate of the window's position. ---@return number displayindex # The index of the display that the window is in. function love.window.getPosition() end --- ---Gets area inside the window which is known to be unobstructed by a system title bar, the iPhone X notch, etc. Useful for making sure UI elements can be seen by the user. --- +---@return number x # Starting position of safe area (x-axis). +---@return number y # Starting position of safe area (y-axis). +---@return number w # Width of safe area. +---@return number h # Height of safe area. function love.window.getSafeArea() end --- @@ -232,8 +238,10 @@ function love.window.setMode(width, height, flags) end --- ---The window position is in the coordinate space of the specified display. --- +---@param x number # The x-coordinate of the window's position. +---@param y number # The y-coordinate of the window's position. ---@param displayindex number # The index of the display that the new window position is relative to. -function love.window.setPosition(displayindex) end +function love.window.setPosition(x, y, displayindex) end --- ---Sets the window title. diff --git a/tools/love-api.lua b/tools/love-api.lua index bb7f6c8e..8117970f 100644 --- a/tools/love-api.lua +++ b/tools/love-api.lua @@ -129,7 +129,7 @@ local function buildFunction(func, node) end local params = {} for _, param in ipairs(func.variants[1].arguments or {}) do - for paramName in param.name:gmatch '[%a_][%w_]+' do + for paramName in param.name:gmatch '[%a_][%w_]*' do params[#params+1] = paramName text[#text+1] = ('---@param %s %s # %s'):format( paramName, @@ -139,7 +139,7 @@ local function buildFunction(func, node) end end for _, rtn in ipairs(func.variants[1].returns or {}) do - for returnName in rtn.name:gmatch '[%a_][%w_]+' do + for returnName in rtn.name:gmatch '[%a_][%w_]*' do text[#text+1] = ('---@return %s %s # %s'):format( buildType(rtn), returnName, |