This commit is contained in:
Jan Racek
2026-03-24 13:00:54 +01:00
parent 53e993f58e
commit 4aa4e49424
145 changed files with 10853 additions and 2965 deletions

49
tools/LUA_VSCODE_SETUP.md Normal file
View File

@@ -0,0 +1,49 @@
# PSXSplash Lua — VS Code Autocomplete Setup
Get full IntelliSense (autocomplete, hover docs, go-to-definition) for the
PSXSplash Lua API in Visual Studio Code.
## 1. Install the Lua Language Server extension
Open VS Code → Extensions → search **sumneko.lua** → Install.
## 2. Point the language server at the stubs
Add (or merge) the following into your workspace `.vscode/settings.json`:
```jsonc
{
"Lua.workspace.library": [
// Path to the EmmyLua stubs shipped with SplashEdit
"${workspaceFolder}/splashedit/tools"
],
"Lua.runtime.version": "Lua 5.2",
"Lua.diagnostics.globals": [
// Event callbacks the engine calls — not "undefined" globals
"onCreate", "onUpdate", "onDestroy",
"onEnable", "onDisable",
"onCollision", "onInteract",
"onTriggerEnter", "onTriggerStay", "onTriggerExit",
"onButtonPress", "onButtonRelease"
]
}
```
> If your Lua scripts live inside the Unity project
> (`kitchensink/Assets/Lua/`), open that folder as the workspace root, then
> adjust the `library` path to be relative to it, e.g.
> `"../splashedit/tools"`.
## 3. Verify
Open any `.lua` script and type `Entity.` — you should see `Find`,
`FindByIndex`, `GetCount`, etc. with full parameter docs.
Hover over `Input.CROSS` to see its type annotation. Hover over `onUpdate`
to see the performance warning.
## Updating the stubs
When the C++ API changes, regenerate `splash_api.lua` from the
`RegisterAll()` function in `psxsplash/src/luaapi.cpp`. The stubs file is
the single source of truth for editor autocomplete.