How to document a function that receives a dictionary? #2559
rodrigoduartetapps
started this conversation in
General
Replies: 1 comment 3 replies
-
You can document your parameter dictionary using a ---you can put general documentation about your dictionary type here
---@class AtlasParams
---
---you can put field documentation here
---@field imageName string # or field docs here
---
---more documentation
---@field info string
---
---more docs
---@field size number
---@param params AtlasParams
function Atlas.loadAtlas(params)
-- implementation
end
Atlas.loadAtlas({ test = true }) -- Missing required fields in type `AtlasParams`: `imageName`, `info`, `size` |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I'm interested in starting to use LuaLS in my projects, but I have a more beginner-oriented question. I have several methods in my projects that receive a parameter dictionary, as exemplified below:
Documenting it this way, I encountered two issues:
The first and more significant problem is that I can't add comments to describe each field in the dictionary (imageName, info, etc.).
The second problem occurs when using the function and passing an undocumented parameter, for example:
In this case, no error is generated. Is there any way to solve these problems?
Thanks in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions