Rogen

Using Luau

The editor, requires and Darklua in a Luau game

Updated

The Editor

luau-lsp builds its sourcemap from default.project.json, which git ignores. After you clone, run rogen write, then Luau: Regenerate Sourcemap. A new feature folder reaches the sourcemap when rogen serve or rogen write updates the project file.

Requires

A Luau require names where the module is in the game, not where the file is on disk, and rogen where <file> prints it. A string require such as require("./Prices") resolves in the game too, so it reaches only the files routed into the same folder.

Darklua

Darklua rewrites src into dist. Its convert_require rule turns path requires into instance requires, which it looks up in sourcemap.json:

.darklua.json
{
	"rules": [
		{
			"rule": "convert_require",
			"current": { "name": "path" },
			"target": {
				"name": "roblox",
				"rojo_sourcemap": "sourcemap.json",
				"indexing_style": "wait_for_child"
			}
		}
	]
}

The sourcemap comes from default.rogen.json, which reads src. Rojo serves from dist.rogen.json, a copy that adds "compiledPath": "dist" and a name, so keep the two in step. On a Rojo project that already uses Darklua, rogen init writes both.

Run each command in its own terminal, the sourcemap first so Darklua can find it. For a release, run each once without --watch, and end with rogen build dist -o game.rbxl:

rogen sourcemap --watch -o sourcemap.json
darklua process src dist --watch
rogen serve dist

On this page