Add missing names to lua return values. Additional return description and overload cleanup. - #3170
Open
sparr wants to merge 1 commit into
Open
Add missing names to lua return values. Additional return description and overload cleanup.#3170sparr wants to merge 1 commit into
sparr wants to merge 1 commit into
Conversation
… and overload cleanup.
efrec
reviewed
Aug 3, 2026
| * @function gl.GetMatrixData | ||
| * @param type GL Matrix type (`GL.PROJECTION`, `GL.MODELVIEW`, `GL.TEXTURE`). | ||
| * @return Matrix4x4 The matrix. | ||
| * @return Matrix4x4 matrix The matrix. |
| * @function gl.GetMatrixData | ||
| * @param name MatrixName The matrix name. | ||
| * @return Matrix4x4 The matrix. | ||
| * @return Matrix4x4 matrix The matrix. |
| * | ||
| * @return boolean allowed | ||
| * @return number the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. | ||
| * @return number newPriority the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. |
There was a problem hiding this comment.
Probably:
Suggested change
| * @return number newPriority the new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. | |
| * @return number newPriority The new priority for this target (if you don't want to change it, return defPriority). Lower priority targets are targeted first. |
| * @param unitID integer | ||
| * | ||
| * @return table<string,number> where keys are piece names and values are piece indices | ||
| * @return table<string,number> pieceInfos where keys are piece names and values are piece indices |
Author
There was a problem hiding this comment.
this name is used multiple other places
| * @function Spring.GetSelectedUnitsSorted | ||
| * @return table<number,number[]> where keys are unitDefIDs and values are unitIDs | ||
| * @return integer the number of unitDefIDs | ||
| * @return table<number,number[]> unitsIDs where keys are unitDefIDs and values are unitIDs |
Author
There was a problem hiding this comment.
I tried to follow the convention from unitsCounts.
| * @return table<number,number[]> where keys are unitDefIDs and values are unitIDs | ||
| * @return integer the number of unitDefIDs | ||
| * @return table<number,number[]> unitsIDs where keys are unitDefIDs and values are unitIDs | ||
| * @return integer count the number of unitDefIDs |
| * | ||
| * @return table<number,number> unitsCounts where keys are unitDefIDs and values are counts | ||
| * @return integer the number of unitDefIDs | ||
| * @return integer count the number of unitDefIDs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generated Lua types have a lot of
@returncomments with descriptions but no names. LuaLS/LuaCATS requires either a name or a#before the description. I opted to add names and attempted to follow the existing naming conventions. While I was there (read: looking at search results for@returninLua*.cpp) I also made what I think are a few other improvements to typings and overloads.https://luals.github.io/wiki/annotations/#return is the relevant documentation for the type annotations.
I discussed this a little on the Beyond All Reason Discord, starting around https://discord.com/channels/549281623154229250/549282166543089674/1533836286358458428. I tried to find the right channel on the Recoil Engine Discord but haven't had much success yet.
Screenshot of VSCode Lua extension (which uses LuaLS) interpreting the first word of the description as the name of the return value:

After: