Coming soon toSteam
Modding docsAPI 1

Script editor

The game has a code editor built in. It edits the files in your mods folder while the game runs, reloads a mod the moment you save, runs Lua inside a running mod, and shows each mod's errors and log next to the code.

Opening it

Press F1 (or the backquote key, F3 or F12) to show the developer tools bar, open its Mods menu and choose Script editor. Typing /tools scripts in the developer console does the same.

The window has four parts:

Drag the edges between the parts to resize them. Ctrl+B hides or shows the explorer, Ctrl+J the panel.

The explorer

Each mod is a top-level entry with a dot for its state: green running, red faulted, blocked or invalid, amber waiting for your consent, grey off. Click a mod or a folder to expand or collapse it, and a file to open it in a tab. The box at the top filters files by name.

The buttons above the list make a new file, a new folder or a new mod, look again for new, removed or changed mods, and collapse every folder. Right-click a row for everything else:

Right-click onYou get
a modNew file…, New folder…, Reload mod, Open mod.json
a folderNew file…, New folder…, Rename…, Duplicate
a fileOpen, Rename…, Duplicate
any rowShow in folder, Copy path, Copy relative path, Delete…
empty spaceNew mod…, Refresh mods, Open the mods folder

Files whose names start with a dot are not listed.

Tabs and files

A dot on a tab marks unsaved changes. Middle-click a tab to close it, or right-click it for Close others, Close saved, Show in explorer and Show in folder. Closing a tab with unsaved changes asks first.

FileOpens as
.lua, .json, .uxml, .uss, .txt, .md, .csv and other textCode. Lua, JSON, layout and style files are coloured.
.png, .jpg, .jpegA picture, with Fit and 100%
anything else (models, sounds, video), or a file that holds binary dataA card with its type and size, Show in folder and Open with system app

Big files are read in the background, so opening one does not stall the game. Text files follow these rules:

Text fileWhat happens
up to 2 MBOpens normally
over 2 MBOpens without colours
over 4 MBOpens read-only, without colours
over 32 MBNot opened: you get the card instead

Files keep their line endings and an existing byte order mark when saved. Tabs in a file become spaces when it opens; the status bar shows the indentation it found, and Tab inserts that many spaces. Enter keeps the indentation, and indents one step more after then, do, function(…) or an open bracket. Typing end, else, until or a closing bracket alone on a line steps it back.

Saving and hot reload

Ctrl+S saves the file and Ctrl+Shift+S saves every tab. While the status bar says Hot reload: On (the default; click it to switch), saving a file of a mod that is switched on reloads that mod straight away: it stops, everything it made is removed, and it starts again with your change. The status bar says how it went: ✓ my-mod reloaded in 14 ms, or the first error with its file and line, which also goes to Problems.

F5, or the reload button next to Run, reloads the current file's mod from what is on disk, without saving.

Editing in another editor

You can keep using your own code editor. While the script editor is open, it watches the mods folder:

Running code

Ctrl+Enter, or Run, runs the selected lines inside the mod the file belongs to, or the whole file when nothing is selected. The code runs with that mod's globals, permissions and time budget. The Client / Server switch next to Run picks which copy of the mod runs it: your own client copy, or the server copy.

The Output tab shows what the code logged, then => and the value of the last expression. An error goes to Problems with the line number of the file, even when you ran a selection from the middle of it.

The Console

The Console tab is a Lua prompt inside a running mod. Choose the mod and Client or Server in the tab's header, type, and press Enter. Shift+Enter starts a new line, and Up and Down step through what you ran before. Results print as => value, errors in red.

mod.side
storage.keys()
mod.settings.all()

As with /lua in the developer console, the code runs inside the mod with its permissions and time budget. It is a way to look into your mod while it runs, not a way around the sandbox.

Problems and error markers

The Problems tab collects the errors and warnings of saving, running and mods that stopped, each with its file and line. Click one to open the file at that line. A mod that faults while you work shows up here at once, and the status bar names the error.

In the editor, a line with a problem is tinted and gets a marker by its line number. Point at the line number to read the message. A mod's problems clear when it reloads cleanly.

The Log

The Log tab follows the mod log: what mods write with log.info, print and the rest, and the errors the game reports for them. Select a mod in the explorer to see only its lines. All, Info, Warnings and Errors filter by level, the box filters by text, and Follow keeps the newest line in view. A file:line in the log is a link to that place.

The Output tab collects what saving, reloading and running report, with a Clear button.

Finding your way

Shortcuts

Ctrl+Shift+/, or Shortcuts in the status bar, shows this list in the game.

Files
Save (reloads the mod)Ctrl+S
Save allCtrl+Shift+S
New fileCtrl+N
Quick openCtrl+P
Close tabCtrl+W
Next tabCtrl+Tab or Ctrl+PgDn
Previous tabCtrl+Shift+Tab or Ctrl+PgUp
Run
Run selection (or file)Ctrl+Enter
Reload modF5
Console: historyUp / Down
Search and navigate
FindCtrl+F
ReplaceCtrl+H
Next / previous matchEnter / Shift+Enter
Go to lineCtrl+G
Word left / rightCtrl+Left / Right
Line start (first character, then column 1) / endHome / End
File start / endCtrl+Home / End
View
Toggle explorerCtrl+B
Toggle bottom panelCtrl+J
Zoom in / out / resetCtrl+= / - / 0
Shortcut listCtrl+Shift+/
Editing
Undo / redoCtrl+Z / Ctrl+Y
Cut / copy / paste (the whole line when nothing is selected)Ctrl+X / C / V
Duplicate line or selectionCtrl+D
Delete lineCtrl+Shift+K
Move line up / downAlt+Up / Down
Toggle commentCtrl+/
Indent / outdentTab / Shift+Tab
Select allCtrl+A
CompletionsCtrl+Space
Explorer
OpenEnter
RenameF2
DeleteDel
Collapse / expandLeft / Right

F1, F3 and F12 always show or hide the developer tools, even while you type. The backquote key does too, except while you are typing in the editor, where it types a backquote.