@gwigz/slua

Getting Started

Set up a new project with TypeScript-to-Lua for Second Life

Scaffold a Project

The fastest way to get started is with the scaffolding CLI:

npx @gwigz/slua-create

This walks you through template selection, optional extras (JSX, config module, yield module, StyLua, linting), and generates a ready-to-build project.

Manual Setup

If you prefer to set things up yourself, install the packages directly:

npm install --save-dev typescript typescript-to-lua @gwigz/slua-types @gwigz/slua-tstl-plugin

Then create a tsconfig.json in your project root:

tsconfig.json
{
  "compilerOptions": {
    "target": "ESNext",
    "module": "ESNext",
    "strict": true,
    "moduleDetection": "force",
    "types": ["@typescript-to-lua/language-extensions", "@gwigz/slua-types"]
  },
  "tstl": {
    "luaTarget": "Luau",
    "luaLibImport": "inline",
    "luaPlugins": [{ "name": "@gwigz/slua-tstl-plugin" }],
    "extension": "slua"
  }
}

See the TSTL configuration docs for all available options.

Editor Setup (Optional)

Map .slua to Lua highlighting in VS Code:

.vscode/settings.json
{
  "files.associations": {
    "*.slua": "lua"
  }
}

Tell GitHub to highlight .slua files as Lua:

.gitattributes
*.slua linguist-language=Lua

You may also like the Second Life SLua/LSL extension for additional language support.

Compile

npx tstl

On this page