A Visual Studio Code extension for writing LUA-NAR scripts — the Lua scripting mod for Kerbal Space Program.
Includes syntax highlighting, autocomplete with docs, live diagnostics, snippets, and one-click deploy to your KSP install.
Features
Syntax Highlighting
Each API category is coloured differently so you can quickly understand your script:
| Colour | Category | Examples |
|---|---|---|
| Teal | Navigation | getLatitude, addManeuverNode, getTimeToApo |
| Yellow | Flight Control | setSAS, setThrottle, activateStage |
| Purple | Autopilot | apStartAscent, apAbort, apGetState |
| Green | Vessel State | getFuelPercent, isLanded, getOrbitApoapsis |
| Orange | UI | guiCreate, guiButton, guiLabel |
| Red | Core Hooks | onTick, setTickRate, logToFile |
Autocomplete
Start typing any LUA-NAR function and IntelliSense fills it in automatically.
- Smart suggestions for valid values (e.g.
setWarp→ 0–7) - Tab-stop snippets for fast scripting
Hover Documentation
Hover over any function to see:
- Parameters
- Return values
- Usage notes
No need to leave the editor.
Live Diagnostics
Get real-time warnings for common mistakes:
- Deprecated functions (suggests replacements)
- Invalid ranges:
setThrottle()outside0–1setWarp()outside0–7actionGroup()outside1–10
Snippets
Type nar- to insert ready-made script templates:
| Prefix | Generates |
|---|---|
nar-tick |
Basic onTick loop |
nar-ascent |
Ascent autopilot |
nar-hud |
Telemetry GUI |
nar-stage |
Auto staging |
nar-maneuver |
Maneuver node setup |
nar-gui |
GUI window |
nar-warp |
Warp to apoapsis |
nar-report |
Orbital report |
Smart Deployment
Stop manually moving files.
- Custom Path: Go to
Settings->LUA-NARand set yourluanar.scriptsFolder. - Deploy on Save: Toggle
luanar.deployOnSaveto sync scripts instantly.
Manual Command:
Right-click a .lua file → Deploy Script to KSP
Recommended Settings
Add this to your settings.json for the best experience:
{
"luanar.scriptsFolder": "C:/Program Files (x86)/Steam/steamapps/common/Kerbal Space Program/GameData/LUA-NAR/Scripts",
"luanar.deployOnSave": true,
"luanar.apiSource": "https://raw.githubusercontent.com/your-repo/LUA-NAR/main/api-docs.json"
}