lloyAlloy on GitHub
namespace
Docs

namespace

Updated
namespace Name ... end

One name over a group of declarations. A member is a function, a const, a local, a struct, an enum, a trait, an interface, a type, an impl, a remote, an attribute, a macro, or another namespace. Outside, a member reads as Name.member; inside, a sibling reads by its own name. An attribute of the group reads as @Name.tag and a macro as $Name.twice(x), with one more step through a nested namespace: @Outer.Inner.tag. A member takes public, the default, or private, which keeps it inside the namespace. export namespace sends the group, and an import brings it in under its own name. @test namespace makes every public function of the group a test; alloy doc test has the rule.

Emits a table: local Name = {}, one name per member, and Name.member on it. A local member is one variable: the table reads and writes it through accessors, so a write inside the group and a write to Name.member reach each other. A const member goes on the table as a copy. A type of the namespace emits as Name_Type, since Luau has no Name.Type type path. A macro emits nothing, because a macro is source; an attribute emits a value and lands on the table.

The word is also free as a name. namespace declares only before a name on the same line, so local namespace = 1 and t.namespace read the Luau way.