AttributeError
UpdatedThe rule behind this error is on the Attributes page.
attribute name(params) on target, ...
attribute service on impl as requires public function Start(self) requires private field state: number end
Declares an attribute: metadata the compiler reads and Attributes reads at runtime. Targets: function, struct, enum, variant, field, param, remote, message, interface, type, local, namespace, impl, trait. A parameter can carry a default, attribute icon(asset: string = "none"); a use that omits the argument gets it, and Attributes.get reads it.
The built-in ones: @derive and @sealed on a struct or an enum; @test and @cfg on a function, @test and @cfg on a namespace too, @cfg on a local as well; @deprecated on a namespace as well; @rename and @skip on a field; @unreliable, @ratelimit, @timeout, and @validate on a remote; @u8 to @f32 on a parameter or a field; and Luau's own @native, @checked, @deprecated, @inline, @noinline, which pass through.
A namespace holds an attribute. Inside the group the bare name reads it; outside it reads as @Name.tag, and @Outer.Inner.tag through a nested namespace. A private one stays inside the group.
The as ... end form states a contract: what the thing the attribute sits on must carry. alloy doc requires has the clause. A declaration with no clause keeps the short form and reads as it always did.
The word is also free as a name. attribute declares only before a name on the same line, so local attribute = 1 and t.attribute read the Luau way.
