-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Write documentation for the Lua API and generate markdown for the docs #354
Comments
As mentioned before, I would be interested in helping writing definition files for the API for use with the Lua Language Server. The definition files could be generated at the same time as the markdown to make things easier to maintain and more consistent. We could potentially write all the documentation using LuaCATS annotations and then use the export documentation feature of the language server to generate JSON and Markdown from the definition files. Although this would require some testing. The other option is to define the entire API in JSON/XML/YAML and then generate the Markdown and LuaCATS annotations from that. It would allow more customization and control, but would also require a custom script. |
@carsakiller would you be interested in doing this? :) You seem pretty knowledgable on that. |
@lionkor, sure! I'm thinking of making a CLI tool that can:
An alternative to the “supplemental” file is we embed the descriptions, examples, etc. as comments (to be parsed still) in the C++ code. This means it will all be in one place at least, but it will make the C++ file larger and cluttered. Curious about your opinion on this. |
I wrote some quick code to parse doc.yamlfunctions:
LuaAPI::MP::GetOSName:
description: >
Get the operating system that the server is currently running on. Possible values are `Windows`, `Linux`, `Other`.
examples:
- |
local os = MP.GetOSName()
print("Currently running on " .. os)
LuaAPI::MP::GetServerVersion:
description: >
Get the current semantic version of the BeamMP Server.
examples:
- |
local version = MP.GetServerVersion()
local major = version[1]
local minor = version[2]
local patch = version[3]
Merging of the two is then output as some Markdown: Markdown Output# MP.GetOSName
Get the operating system that the server is currently running on. Possible values are `Windows`, `Linux`, `Other`.
`MP.GetOSName() -> string`
## Examples
```lua
local os = MP.GetOSName()
print("Currently running on " .. os)
```
# MP.GetServerVersion
Get the current semantic version of the BeamMP Server.
`MP.GetServerVersion() -> { number, number, number }`
## Examples
```lua
local version = MP.GetServerVersion()
local major = version[1]
local minor = version[2]
local patch = version[3]
``` We can already start to see some issues here where, sure, the types of AssertionsFor MappingsIn To fix the mapping issue, we could create a For the other problems, we need a better way to define types, as they will appear for Lua plugins. We could keep expanding the // Description of function here!
// @param ConfigID number Description of this parameter
// @param NewValue number|boolean|string Description of this parameter
// @return boolean success Description of this return value
// @example Example Name
// ```
// ...
// ```
// @example Example2
// ```
// ...
// ```
void LuaAPI::MP::Set(int ConfigID, sol::object NewValue) { Thoughts, @lionkor? |
Related to #355. Basically, we want to generate the Lua Docs page from the LuaAPI.cpp or LuaAPI.h file. This can be a script, it can use doxygen, it can use whatever.
It needs to:
The text was updated successfully, but these errors were encountered: