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-createThis 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-pluginThen create a tsconfig.json in your project root:
{
"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:
{
"files.associations": {
"*.slua": "lua"
}
}Tell GitHub to highlight .slua files as Lua:
*.slua linguist-language=LuaYou may also like the Second Life SLua/LSL extension for additional language support.
Compile
npx tstl