Updated meta files#12
Conversation
carsakiller
left a comment
There was a problem hiding this comment.
Hello! Thank you for taking the time to contribute.
There are quite a few places where a more specific/informational type like string[] or love.RecordingDevices[] was replaced with just table, or similar. It would be best to keep the specific types as they are much more useful.
There were also a few changes that seem to disagree with the official documentation, but other than those, it is mainly small tweaks and typos.
| ---[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. |
There was a problem hiding this comment.
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.
| ---@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. |
There was a problem hiding this comment.
Both the current and incoming documentation contain useful information.
I think they should be combined.
| ---@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. |
| ---[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. |
There was a problem hiding this comment.
This is overwriting the love.RecordingDevice[] type with a less descriptive and helpful table type, effectively losing a bunch of helpful type information.
| ---@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. |
There was a problem hiding this comment.
| ---@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) |
There was a problem hiding this comment.
Little typo
| ---@overload fun(test: number, font: love.Font, transform: love.Transform) | |
| ---@overload fun(text: number, font: love.Font, transform: love.Transform) |
| ---@param quad2 love.Quad # The second Quad to use. | ||
| function ParticleSystem:setQuads(quad1, quad2) end |
There was a problem hiding this comment.
Seems to require at least 2 args, but can be given more: https://www.love2d.org/wiki/ParticleSystem:setQuads
| ---@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 |
| ---@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.) |
There was a problem hiding this comment.
According to the official documentation, the previous documentation seems correct, with sw and sh being optional.
| --- | ||
| ---@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 |
There was a problem hiding this comment.
Many more args are possible.
| ---@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 |
| --- | ||
| ---@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 |
There was a problem hiding this comment.
| ---@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 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 |
There was a problem hiding this comment.
The additional arguments are both numerous and optional so it would probably be best to do the following:
| ---@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 |
|
hmm sorry I didn't know I have to update the things by hand. I just ran |
|
Hmm, the update script uses an old script from the language server to generate the annotations for love2d, but it seemingly doesn't handle the above issues properly. Looking at the PR that added the update script it looks like there was another commit where the author fixed the above type issues manually. The update script uses love2d-community/love-api, which doesn't seem to contain information about specific types/classes. For So really the problem is that both the official wiki and the community API documentation don't contain the needed information. We would have to guess that |
|
I have created an issue on the api repo to see if there is a way for us to get the missing type info. It would be great to get the needed info from there, and then we can just use a script to automate updates. Otherwise, there will need to be manual tweaking to fix the missing type info. |
I don't think it needs much explaination. It was outdated :)