Sugar
Shapes Luau rejects today, each with a one-line emit
UpdatedA 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 : bnests, and a fusedx: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.
deletepicksDisconnect,disconnect,Destroy, ordestroyat runtime, so a user class and a signal both work.constpasses through to Luau's own, so a reassignment is a compile error;x in t,...spread,bnotand the other word operators, and interpolated strings with Alloy in the holes.
