50 lines
1.6 KiB
Markdown
50 lines
1.6 KiB
Markdown
# 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.
|