Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions library/love/audio.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ love.audio = {}
---
---[Open in Browser](https://love2d.org/wiki/love.audio.getActiveEffects)
---
---@return string[] effects # The list of the names of the currently enabled effects.
---@return table effects # The list of the names of the currently enabled effects.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the table returned not a string[]? The official documentation doesn't seem to offer any insight into the table's contents, but it seems from the description that it would be an "array" of strings.

function love.audio.getActiveEffects() end

---
Expand Down Expand Up @@ -79,12 +79,12 @@ function love.audio.getMaxSourceEffects() end
---
---[Open in Browser](https://love2d.org/wiki/love.audio.getOrientation)
---
---@return number fx # Forward x of the listener orientation.
---@return number fy # Forward y of the listener orientation.
---@return number fz # Forward z of the listener orientation.
---@return number ux # Up x of the listener orientation.
---@return number uy # Up y of the listener orientation.
---@return number uz # Up z of the listener orientation.
---@return number fx # Forward vector of the listener orientation.
---@return number fy # Forward vector of the listener orientation.
---@return number fz # Forward vector of the listener orientation.
---@return number ux # Up vector of the listener orientation.
---@return number uy # Up vector of the listener orientation.
---@return number uz # Up vector of the listener orientation.
Comment on lines +82 to +87
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the current and incoming documentation contain useful information.

I think they should be combined.

Suggested change
---@return number fx # Forward vector of the listener orientation.
---@return number fy # Forward vector of the listener orientation.
---@return number fz # Forward vector of the listener orientation.
---@return number ux # Up vector of the listener orientation.
---@return number uy # Up vector of the listener orientation.
---@return number uz # Up vector of the listener orientation.
---@return number fx # Forward vector x component of the listener orientation.
---@return number fy # Forward vector y component of the listener orientation.
---@return number fz # Forward vector z component of the listener orientation.
---@return number ux # Up vector x component of the listener orientation.
---@return number uy # Up vector y component of the listener orientation.
---@return number uz # Up vector z component of the listener orientation.

function love.audio.getOrientation() end

---
Expand All @@ -108,7 +108,7 @@ function love.audio.getPosition() end
---
---[Open in Browser](https://love2d.org/wiki/love.audio.getRecordingDevices)
---
---@return love.RecordingDevice[] devices # The list of connected recording devices.
---@return table devices # The list of connected recording devices.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is overwriting the love.RecordingDevice[] type with a less descriptive and helpful table type, effectively losing a bunch of helpful type information.

function love.audio.getRecordingDevices() end

---
Expand Down Expand Up @@ -178,7 +178,7 @@ function love.audio.newSource(filename, type) end
---
---@overload fun(source: love.Source, ...)
---@overload fun(sources: table)
---@return love.Source[] Sources # A table containing a list of Sources that were paused by this call.
---@return table Sources # A table containing a list of Sources that were paused by this call.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function love.audio.pause() end

---
Expand Down Expand Up @@ -416,7 +416,7 @@ function Source:clone() end
---
---[Open in Browser](https://love2d.org/wiki/Source:getActiveEffects)
---
---@return string[] effects # A list of the source's active effect names.
---@return table effects # A list of the source's active effect names.
function Source:getActiveEffects() end

---
Expand Down
2 changes: 1 addition & 1 deletion library/love/filesystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function love.filesystem.getCRequirePath() end
---
---@overload fun(dir: string, callback: function):table
---@param dir string # The directory.
---@return string[] files # A sequence with the names of all files and subdirectories as strings.
---@return table files # A sequence with the names of all files and subdirectories as strings.
function love.filesystem.getDirectoryItems(dir) end

---
Expand Down
49 changes: 30 additions & 19 deletions library/love/graphics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -945,12 +945,14 @@ function love.graphics.present() end
---
---[Open in Browser](https://love2d.org/wiki/love.graphics.print)
---
---@overload fun(coloredtext: table, x?: number, y?: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@overload fun(text: string, transform: love.Transform)
---@overload fun(coloredtext: table, transform: love.Transform)
---@overload fun(text: string, font: love.Font, transform: love.Transform)
---@overload fun(text: number, transform: love.Transform)
---@overload fun(test: number, font: love.Font, transform: love.Transform)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Little typo

Suggested change
---@overload fun(test: number, font: love.Font, transform: love.Transform)
---@overload fun(text: number, font: love.Font, transform: love.Transform)

---@overload fun(coloredtext: table, x?: number, y?: number, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@overload fun(coloredtext: table, transform: love.Transform)
---@overload fun(coloredtext: table, font: love.Font, transform: love.Transform)
---@param text string # The text to draw.
---@param text string|number # 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).
Expand Down Expand Up @@ -979,11 +981,14 @@ function love.graphics.print(text, x, y, r, sx, sy, ox, oy, kx, ky) end
---@overload fun(text: string, font: love.Font, x: number, y: number, limit: number, align?: love.AlignMode, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@overload fun(text: string, transform: love.Transform, limit: number, align?: love.AlignMode)
---@overload fun(text: string, font: love.Font, transform: love.Transform, limit: number, align?: love.AlignMode)
---@overload fun(text: number, font: love.Font, x: number, y: number, limit: number, align?: love.AlignMode, r?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@overload fun(text: number, transform: love.Transform, limit: number, align?: love.AlignMode)
---@overload fun(text: number, font: love.Font, transform: love.Transform, limit: number, align?: love.AlignMode)
---@overload fun(coloredtext: table, x: number, y: number, limit: number, align: love.AlignMode, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@overload fun(coloredtext: table, font: love.Font, x: number, y: number, limit: number, align?: love.AlignMode, angle?: number, sx?: number, sy?: number, ox?: number, oy?: number, kx?: number, ky?: number)
---@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 text string|number # 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.
Expand Down Expand Up @@ -1438,8 +1443,7 @@ function Canvas:newImageData() end
---[Open in Browser](https://love2d.org/wiki/Canvas:renderTo)
---
---@param func function # A function performing drawing operations.
---@vararg any # Additional arguments to call the function with.
function Canvas:renderTo(func, ...) end
function Canvas:renderTo(func) end
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to match the function signatures available in the official documentation.


---
---Superclass for all things that can be drawn on screen. This is an abstract type that can't be created directly.
Expand Down Expand Up @@ -1558,7 +1562,7 @@ function Font:getLineHeight() end
---
---[Open in Browser](https://love2d.org/wiki/Font:getWidth)
---
---@param text string # A string.
---@param text string|number # A string or number.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tested that this is actually supported? The documentation states string only and even if number technically works right now, if it is not officially supported/recommended, it should probably be left as string only.

---@return number width # The width of the text.
function Font:getWidth(text) end

Expand All @@ -1573,7 +1577,7 @@ function Font:getWidth(text) end
---@param text string # The text that will be wrapped.
---@param wraplimit number # The maximum width in pixels of each line that ''text'' is allowed before wrapping.
---@return number width # The maximum width of the wrapped text.
---@return string[] wrappedtext # A sequence containing each line of text that was wrapped.
---@return table wrappedtext # A sequence containing each line of text that was wrapped.
function Font:getWrap(text, wraplimit) end

---
Expand Down Expand Up @@ -1788,7 +1792,7 @@ function Mesh:getVertexFormat() end
---
---[Open in Browser](https://love2d.org/wiki/Mesh:getVertexMap)
---
---@return number[] map # A table containing the list of vertex indices used when drawing.
---@return table map # A table containing the list of vertex indices used when drawing.
function Mesh:getVertexMap() end

---
Expand Down Expand Up @@ -2078,7 +2082,7 @@ function ParticleSystem:getPosition() end
---
---[Open in Browser](https://love2d.org/wiki/ParticleSystem:getQuads)
---
---@return love.Quad[] quads # A table containing the Quads used.
---@return table quads # A table containing the Quads used.
function ParticleSystem:getQuads() end

---
Expand Down Expand Up @@ -2260,13 +2264,20 @@ function ParticleSystem:setBufferSize(size) end
---
---[Open in Browser](https://love2d.org/wiki/ParticleSystem:setColors)
---
---@overload fun(self: love.ParticleSystem, rgba1: table, ...)
---@overload fun(self: love.ParticleSystem, rgba1: table, rgba2: table, rgba8: table)
---@param r1 number # First color, red component (0-1).
---@param g1 number # First color, green component (0-1).
---@param b1 number # First color, blue component (0-1).
---@param a1? number # First color, alpha component (0-1).
---@vararg number # Additional colors.
function ParticleSystem:setColors(r1, g1, b1, a1, ...) end
---@param r2? number # Second color, red component (0-1).
---@param g2? number # Second color, green component (0-1).
---@param b2? number # Second color, blue component (0-1).
---@param a2? number # Second color, alpha component (0-1).
---@param r8? number # Eighth color, red component (0-1).
---@param g8? number # Eighth color, green component (0-1).
---@param b8? number # Eighth color, blue component (0-1).
---@param a8? number # Eighth color, alpha component (0-1).
function ParticleSystem:setColors(r1, g1, b1, a1, r2, g2, b2, a2, r8, g8, b8, a8) end
Comment on lines +2267 to +2280
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have never seen a function like this, holy.

Regardless, it looks like you can pass 8 colors, each with a r, g, b, a component, so up to 32 parameters. Then there is the more reasonable overload with up to 8 {r, g, b, a?} tables.

Perhaps it would be best to do:

Suggested change
---@overload fun(self: love.ParticleSystem, rgba1: table, rgba2: table, rgba8: table)
---@param r1 number # First color, red component (0-1).
---@param g1 number # First color, green component (0-1).
---@param b1 number # First color, blue component (0-1).
---@param a1? number # First color, alpha component (0-1).
---@vararg number # Additional colors.
function ParticleSystem:setColors(r1, g1, b1, a1, ...) end
---@param r2? number # Second color, red component (0-1).
---@param g2? number # Second color, green component (0-1).
---@param b2? number # Second color, blue component (0-1).
---@param a2? number # Second color, alpha component (0-1).
---@param r8? number # Eighth color, red component (0-1).
---@param g8? number # Eighth color, green component (0-1).
---@param b8? number # Eighth color, blue component (0-1).
---@param a8? number # Eighth color, alpha component (0-1).
function ParticleSystem:setColors(r1, g1, b1, a1, r2, g2, b2, a2, r8, g8, b8, a8) end
---@param r1 number # First color, red component (0-1).
---@param g1 number # First color, green component (0-1).
---@param b1 number # First color, blue component (0-1).
---@param a1? number # First color, alpha component (0-1).
---@param ... number # Additional colors.
---@overload fun(self: love.ParticleSystem, rgba1: table, rgba2: table, rgba3: table, rgba4: table, rgba5: table, rgba6: table, rgba7: table, rgba8: table)
function ParticleSystem:setColors(r1, g1, b1, a1, ...) end

The description could probably use an improvement to explain the two usages as well and the default behaviour when leaving out alpha channels, etc.


---
---Sets the direction the particles will be emitted in.
Expand Down Expand Up @@ -2381,8 +2392,8 @@ function ParticleSystem:setPosition(x, y) end
---
---@overload fun(self: love.ParticleSystem, quads: table)
---@param quad1 love.Quad # The first Quad to use.
---@vararg love.Quad # Additional Quads to use.
function ParticleSystem:setQuads(quad1, ...) end
---@param quad2 love.Quad # The second Quad to use.
function ParticleSystem:setQuads(quad1, quad2) end
Comment on lines +2395 to +2396
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to require at least 2 args, but can be given more: https://www.love2d.org/wiki/ParticleSystem:setQuads

Suggested change
---@param quad2 love.Quad # The second Quad to use.
function ParticleSystem:setQuads(quad1, quad2) end
---@param quad2 love.Quad # The second Quad to use.
---@param ... love.Quad # Additional Quads
function ParticleSystem:setQuads(quad1, quad2, ...) end


---
---Set the radial acceleration (away from the emitter).
Expand Down Expand Up @@ -2560,8 +2571,8 @@ function Quad:getViewport() end
---@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 # Optional new reference width, the width of the Texture. Must be greater than 0 if set.
---@param sh? number # Optional new reference height, the height of the Texture. Must be greater than 0 if set.
---@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.)
Comment on lines +2574 to +2575
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the official documentation, the previous documentation seems correct, with sw and sh being optional.

function Quad:setViewport(x, y, w, h, sw, sh) end

---
Expand Down Expand Up @@ -2652,8 +2663,8 @@ function Shader:send(name, number, ...) end
---[Open in Browser](https://love2d.org/wiki/Shader:sendColor)
---
---@param name string # The name of the color extern variable to send to in the shader.
---@param color number[] # A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector.
---@vararg number[] # Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3's).
---@param color table # A table with red, green, blue, and optional alpha color components in the range of 1 to send to the extern as a vector.
---@vararg table # Additional colors to send in case the extern is an array. All colors need to be of the same size (e.g. only vec3's).
function Shader:sendColor(name, color, ...) end

---
Expand Down
2 changes: 1 addition & 1 deletion library/love/joystick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function love.joystick.getJoystickCount() end
---
---[Open in Browser](https://love2d.org/wiki/love.joystick.getJoysticks)
---
---@return love.Joystick[] joysticks # The list of currently connected Joysticks.
---@return table joysticks # The list of currently connected Joysticks.
function love.joystick.getJoysticks() end

---
Expand Down
12 changes: 6 additions & 6 deletions library/love/math.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ function love.math.getRandomState() end
---
---[Open in Browser](https://love2d.org/wiki/love.math.isConvex)
---
---@overload fun(x1: number, y1: number, x2: number, y2: number, ...):boolean
---@param vertices number[] # The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):boolean
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many more args are possible.

Suggested change
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):boolean
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, ...: number):boolean

---@param vertices table # The vertices of the polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
---@return boolean convex # Whether the given polygon is convex.
function love.math.isConvex(vertices) end

Expand Down Expand Up @@ -127,8 +127,8 @@ function love.math.linearToGamma(lr, lg, lb) end
---
---[Open in Browser](https://love2d.org/wiki/love.math.newBezierCurve)
---
---@overload fun(x1: number, y1: number, x2: number, y2: number, ...):love.BezierCurve
---@param vertices number[] # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):love.BezierCurve
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number):love.BezierCurve
---@overload fun(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, ...: number):love.BezierCurve

---@param vertices table # The vertices of the control polygon as a table in the form of {x1, y1, x2, y2, x3, y3, ...}.
---@return love.BezierCurve curve # A Bézier curve object.
function love.math.newBezierCurve(vertices) end

Expand Down Expand Up @@ -330,7 +330,7 @@ function BezierCurve:removeControlPoint(index) end
---[Open in Browser](https://love2d.org/wiki/BezierCurve:render)
---
---@param depth? number # Number of recursive subdivision steps.
---@return number[] coordinates # List of x,y-coordinate pairs of points on the curve.
---@return table coordinates # List of x,y-coordinate pairs of points on the curve.
function BezierCurve:render(depth) end

---
Expand All @@ -346,7 +346,7 @@ function BezierCurve:render(depth) end
---@param startpoint number # The starting point along the curve. Must be between 0 and 1.
---@param endpoint number # The end of the segment to render. Must be between 0 and 1.
---@param depth? number # Number of recursive subdivision steps.
---@return number[] coordinates # List of x,y-coordinate pairs of points on the specified part of the curve.
---@return table coordinates # List of x,y-coordinate pairs of points on the specified part of the curve.
function BezierCurve:renderSegment(startpoint, endpoint, depth) end

---
Expand Down
12 changes: 6 additions & 6 deletions library/love/physics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ function Body:getAngularVelocity() end
---
---[Open in Browser](https://love2d.org/wiki/Body:getContacts)
---
---@return love.Contact[] contacts # A list with all contacts associated with the Body.
---@return table contacts # A list with all contacts associated with the Body.
function Body:getContacts() end

---
Expand All @@ -500,7 +500,7 @@ function Body:getContacts() end
---
---[Open in Browser](https://love2d.org/wiki/Body:getFixtures)
---
---@return love.Fixture[] fixtures # A sequence with all fixtures.
---@return table fixtures # A sequence with all fixtures.
function Body:getFixtures() end

---
Expand Down Expand Up @@ -529,7 +529,7 @@ function Body:getInertia() end
---
---[Open in Browser](https://love2d.org/wiki/Body:getJoints)
---
---@return love.Joint[] joints # A sequence with the Joints attached to the Body.
---@return table joints # A sequence with the Joints attached to the Body.
function Body:getJoints() end

---
Expand Down Expand Up @@ -2989,7 +2989,7 @@ function World:destroy() end
---
---[Open in Browser](https://love2d.org/wiki/World:getBodies)
---
---@return love.Body[] bodies # A sequence with all bodies.
---@return table bodies # A sequence with all bodies.
function World:getBodies() end

---
Expand Down Expand Up @@ -3037,7 +3037,7 @@ function World:getContactFilter() end
---
---[Open in Browser](https://love2d.org/wiki/World:getContacts)
---
---@return love.Contact[] contacts # A sequence with all Contacts.
---@return table contacts # A sequence with all Contacts.
function World:getContacts() end

---
Expand Down Expand Up @@ -3065,7 +3065,7 @@ function World:getJointCount() end
---
---[Open in Browser](https://love2d.org/wiki/World:getJoints)
---
---@return love.Joint[] joints # A sequence with all joints.
---@return table joints # A sequence with all joints.
function World:getJoints() end

---
Expand Down
3 changes: 2 additions & 1 deletion library/love/thread.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ function Channel:peek() end
---[Open in Browser](https://love2d.org/wiki/Channel:performAtomic)
---
---@param func function # The function to call, the form of function(channel, arg1, arg2, ...) end. The Channel is passed as the first argument to the function when it is called.
---@param arg1 any # Additional arguments that the given function will receive when it is called.
---@vararg any # Additional arguments that the given function will receive when it is called.
---@return any ret1 # The first return value of the given function (if any.)
function Channel:performAtomic(func, ...) end
function Channel:performAtomic(func, arg1, ...) end
Comment on lines +121 to +124
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional arguments are both numerous and optional so it would probably be best to do the following:

Suggested change
---@param arg1 any # Additional arguments that the given function will receive when it is called.
---@vararg any # Additional arguments that the given function will receive when it is called.
---@return any ret1 # The first return value of the given function (if any.)
function Channel:performAtomic(func, ...) end
function Channel:performAtomic(func, arg1, ...) end
---@param ... any # Additional arguments that the given function will
---@return any ret1 # The first return value of the given function (if any.)
function Channel:performAtomic(func, ...) end


---
---Retrieves the value of a Channel message and removes it from the message queue.
Expand Down
2 changes: 1 addition & 1 deletion library/love/touch.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ function love.touch.getPressure(id) end
---
---[Open in Browser](https://love2d.org/wiki/love.touch.getTouches)
---
---@return lightuserdata[] touches # A list of active touch-press id values, which can be used with love.touch.getPosition.
---@return table touches # A list of active touch-press id values, which can be used with love.touch.getPosition.
function love.touch.getTouches() end
2 changes: 1 addition & 1 deletion library/love/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function love.window.getFullscreen() end
---[Open in Browser](https://love2d.org/wiki/love.window.getFullscreenModes)
---
---@param displayindex? number # The index of the display, if multiple monitors are available.
---@return {width: number, height: number} modes # A table of width/height pairs. (Note that this may not be in order.)
---@return table modes # A table of width/height pairs. (Note that this may not be in order.)
function love.window.getFullscreenModes(displayindex) end

---
Expand Down