Skip to content

Commit

Permalink
lua docs - type checking
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Nov 16, 2024
1 parent 3a3ea53 commit 2f25675
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/lua/type_checking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Type checking


1. Download and install [Luau language server](https://marketplace.visualstudio.com/items?itemName=JohnnyMorganz.luau-lsp) for VS Code.
2. Open `data` folder in VS Code.
3. Create VS Code workspace settings (`data/.vscode/settings.json`).
4. Put following json there:
```js
{
"luau-lsp.types.definitionFiles": ["scripts/lumix.d.lua"],
}
```
5. Create `.luaurc` in `data\scripts\` and put following json there:
```js
{
"languageMode": "nonstrict",
"lint": { "*": true, "FunctionUnused": false },
"lintErrors": true,
"globals": ["expect"]
}
```
6. Typechecking should now work, you can test with following script:
```lua
function onInputEvent(event : InputEvent)
return event.some_prop
end
```

3 changes: 3 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* [Job System](job_system.md)
* [Profiler](profiler.md)

# Lua
* [Type checking](lua/type_checking.md)

# Renderer

* [Shaders](shaders.md)
Expand Down

0 comments on commit 2f25675

Please sign in to comment.