New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lua API: Add inline documentation for pretty much everything #6483
Conversation
@@ -120,7 +162,7 @@ if wesnoth.kernel_type() == "Game Lua Kernel" then | |||
elseif key == 2 then | |||
return self.y | |||
elseif type(key) ~= string or (#key > 0 and key[0] ~= '_') then | |||
return hex_mt[key] | |||
return hex_methods[key] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's an issue here, as a) I don't remember why the ~= string
test was added and b) the ~= string
test itself is wrong. I think it's out of scope for this PR though.
---A generic container that lays out its children in a grid | ||
---@class grid : widget | ||
|
||
---@class gui.widget |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not confident that the above covers every possible type of widget… can anyone see one I've missed?
Untested, but I think that returns an empty string instead of nil.
|
Oh right, you're probably right. So I'll delete that last commit then. |
Okay, I see three unresolved comments… not counting the two that are unrelated to the actual content of this PR. |
… documentation The new format is EmmyLua-based and can be used with (at least) Visual Studio Code.
@CelticMinstrel , I've now finished reading all the files. |
Okay, unless you have further comments regarding my replies and latest commits, I think this is ready to squash. |
---@field plague_type string If the attack inflicts plague, this specifies the unit type it is converted to. | ||
---@field backstabs boolean | ||
---@field rounds integer The number of rounds of combat. | ||
---@field firststrike boolean Indicates whether the attack always strikes first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but suspect many of the booleans here are whether the ability is active in the particular fight (whether the opponent is immune to poison, also has firststrike, etc).
…ert existing docs (wesnoth#6483) The new format is EmmyLua-based and can be used with (at least) Visual Studio Code.
I did this several months ago but never got around to submitting it, so there might be something missing here and there if things have changed since then.
In addition to covering things defined in Lua, this includes stub definitions with documentation of everything defined in C++, in the utils/emmylua folder.
The Lua add-on for Visual Studio Code uses this format to improve tooltips and auto-completion.