luttje / luttje/glua-api-snippets
`FCVAR_*` constants produce warnings for `CreateConVar`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 45
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
Doing something like:
```lua
CreateConVar("enable_the_thing", '1', FCVAR_REPLICATED)
```
... will make LuaLS erroneously produce a warning:
```
Cannot assign `integer` to parameter `(`FCVAR_ARCHIVE_XBOX`|`FCVAR_ARCHIVE`|`FCVAR_CHEAT`|`FCVAR_CLIENTCMD_CAN_EXECUTE`|`FCVAR_CLIENTDLL`...(+19))?`.
- `integer` cannot match `(`FCVAR_ARCHIVE_XBOX`|`FCVAR_ARCHIVE`|`FCVAR_CHEAT`|`FCVAR_CLIENTCMD_CAN_EXECUTE`|`FCVAR_CLIENTDLL`...(+19))?`
- Type `integer` cannot match `nil`
- Type `number` cannot match `nil`
- Type `integer` cannot match `number[]`
- Type `number` cannot match `number[]`
```
I can only assume that this is somehow because of either the type definition for `FCVAR`, or the type of the `FCVAR_*` constants.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the FCVAR type definition and FCVAR_* constants used by the generated Lua Language Server comments, then reproduce the CreateConVar example with LuaLS. Done means passing FCVAR_REPLICATED to CreateConVar no longer produces the reported type warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100