lloyAlloy on GitHub
Sugar
Docs

Sugar

Shapes Luau rejects today, each with a one-line emit

Updated

A ternary, an object initializer, array destructuring, a method reference, and delete with runtime dispatch. Every form keeps its line.

Alloysugar.aly
1local tier = level > 5 ? "high" : "low"
2local part = new Instance("Part") {
3    Name = "Marker",
4    Anchored = true,
5}
6local [ head, ...rest ] = [ 1, 2, 3 ]
7button.Activated:Connect(self:on_click)
8delete part
Emitted Luausame line count
1local __alloy = require("@alloy") local tier = (if level > 5 then "high" else "low")
2local part = Instance.new("Part")
3    part.Name = "Marker"
4    part.Anchored = true
5
6local _1 = __alloy.Array.from({ 1, 2, 3 }) local head, rest = _1[1], __alloy.Array.slice(_1, 2)
7button.Activated:Connect(__alloy.bind(self, self.on_click))
8__alloy.delete(part) return nil
  • c ? a : b nests, and a fused x:upper() inside a branch stays a method call.
  • The initializer assigns one field per line, so a field that throws traces to its own line, and the binding hovers with its class.
  • delete picks Disconnect, disconnect, Destroy, or destroy at runtime, so a user class and a signal both work.
  • const passes through to Luau's own, so a reassignment is a compile error; x in t, ...spread, bnot and the other word operators, and interpolated strings with Alloy in the holes.