Skip to content

public / private / protected

OOP

Parsed and ignored. Luau has no access specifiers.

struct S {
public:
int x;
private:
int y;
};

None.

None.

(omitted)

They exist so C++-looking headers parse. Encapsulation is by ModuleScript surface, not the compiler.

struct S {
public:
int x;
};

Emits:

-- fields still emit on the type

struct