From 2f25675dea707fbe39ec23b5d93cd0151ab2b31a Mon Sep 17 00:00:00 2001 From: Mikulas Florek Date: Sat, 16 Nov 2024 10:27:13 +0100 Subject: [PATCH] lua docs - type checking --- docs/lua/type_checking.md | 28 ++++++++++++++++++++++++++++ docs/readme.md | 3 +++ 2 files changed, 31 insertions(+) create mode 100644 docs/lua/type_checking.md diff --git a/docs/lua/type_checking.md b/docs/lua/type_checking.md new file mode 100644 index 0000000000..2b7c40c74b --- /dev/null +++ b/docs/lua/type_checking.md @@ -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 +``` + diff --git a/docs/readme.md b/docs/readme.md index 9bc485de14..2248d6561a 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -6,6 +6,9 @@ * [Job System](job_system.md) * [Profiler](profiler.md) +# Lua +* [Type checking](lua/type_checking.md) + # Renderer * [Shaders](shaders.md)