Skip to content
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

Annotation typos and outdated meta information #4

Open
astrochili opened this issue Jan 22, 2024 · 15 comments
Open

Annotation typos and outdated meta information #4

astrochili opened this issue Jan 22, 2024 · 15 comments
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed

Comments

@astrochili
Copy link
Owner

astrochili commented Jan 22, 2024

Fixing annotation typos and outdated meta information requires edits to the Defold source code, as this is the main source of documentation generation.

This issue is an attempt to collect that kind of bugs in one place and prepare pull requests to Defold batchwise. So feel free to share any annotation issues here. It will be more useful than fixing these bugs locally or just ignoring them.

@astrochili astrochili added documentation Improvements or additions to documentation help wanted Extra attention is needed good first issue Good for newcomers labels Jan 22, 2024
@swajj
Copy link

swajj commented Jan 23, 2024

This may be a Defold doc bug as well? particlefx.stop is annotated with a required options parameter, but it is actually optional as seen at https://defold.com/manuals/particlefx/?q=particlefx.stop#controlling-a-particle-effect - however the Defold API reference does NOT indicate it is optional at the moment.

---Stopping a particle FX does not remove already spawned particles.
---Which particle FX to stop is identified by the URL.
---@param url string|hash|url the particle fx that should stop playing
---@param options table Options when stopping the particle fx. Supported options:
---
---boolean clear: instantly clear spawned particles
---
function particlefx.stop(url, options) end
image

@swajj
Copy link

swajj commented Jan 23, 2024

The annotations are missing operators for vector3/4.
image

I had these added to my custom copy of what you're currently storing in types.lua, they work for me to prevent things like the above:

---@class vector3
---@operator sub(vector3): vector3
---@operator add(vector3): vector3
---@operator mul(number): vector3
---@operator unm: vector3

---@class vector4
---@operator sub(vector4): vector4
---@operator add(vector4): vector4
---@operator mul(number): vector4
---@operator unm: vector4

@Jerakin
Copy link

Jerakin commented Apr 7, 2024

gui.is_enabled() should have the second argument as optional.

image

@Jerakin
Copy link

Jerakin commented Apr 7, 2024

gui.set_text() should also accepts integers.
image

@astrochili
Copy link
Owner Author

astrochili commented Apr 7, 2024

Prepared everything mentioned above in this commit - astrochili/defold@6637dec.

Waiting for a while, in case @Jerakin finds something else, and I'll send the PR to Defold.

Also I added operators for vector3/4 and matrix4 defenition to this repository.

@Jerakin
Copy link

Jerakin commented Apr 7, 2024

Can the "standard" functions within Defold be annotated?
image

I am using a my template editor extension currently when creating new files to get the annotations but would be neat if some basic ones could be automatic, (I bet the action table would be hard) - of course there isn't much to annotate, but if possible why not :)

@astrochili
Copy link
Owner Author

To be honest, I don't know how to do it globally, as each update function has its own file context... and at the same time they are global dublicates for LLS. This requires experimentation.

But in templates you can of course just write:

---@param self table (or your local `SCRIPT_NAME.self` class?)
---@param dt number
function update(self, dt)
  ...
end

@astrochili
Copy link
Owner Author

astrochili commented Apr 9, 2024

Created PR to Defold defold/defold#8776

@astrochili
Copy link
Owner Author

astrochili commented Apr 9, 2024

Updated the 1.7.0 release with all these fixes.
Also added a lot of known table defenitions according #1.

Feel free to tell me about 'yellow underlines' if you see them. I may have made mistakes in tables or annotations, the edit was a major one.

@Jerakin
Copy link

Jerakin commented Apr 13, 2024

gui.set_parent(node, parent, keep_scene_transform) should accepts nil as parent. Supplying nil "parents" it to the scene (i.e remove the parent).
image

@astrochili
Copy link
Owner Author

gui.set_parent(node, parent, keep_scene_transform) should accepts nil as parent. Supplying nil "parents" it to the scene (i.e remove the parent). image

@astrochili astrochili pinned this issue Apr 29, 2024
@Insality
Copy link

sys.reboot params should be string|nil

---@param arg1 string argument 1
---@param arg2 string argument 2
---@param arg3 string argument 3
---@param arg4 string argument 4
---@param arg5 string argument 5
---@param arg6 string argument 6
function sys.reboot(arg1, arg2, arg3, arg4, arg5, arg6) end

@astrochili
Copy link
Owner Author

sys.reboot params should be string|nil

---@param arg1 string argument 1
---@param arg2 string argument 2
---@param arg3 string argument 3
---@param arg4 string argument 4
---@param arg5 string argument 5
---@param arg6 string argument 6
function sys.reboot(arg1, arg2, arg3, arg4, arg5, arg6) end

Interesting. Are you sure? I am not good at c++, but in the source code some 6 arguments are processed.

@astrochili
Copy link
Owner Author

Ah okay, sorry, just need to add |nil! 👍

@astrochili
Copy link
Owner Author

sys.reboot params should be string|nil

Added PR defold/defold#8976
Updated manually 1.8.0 annotations release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants