Types
CL++ is statically typed in what you write and in the Luau it emits.
Primitives
Section titled “Primitives”| CL++ | Luau | Use |
|---|---|---|
int / float / double | number | counts, damage, alpha |
bool | boolean | flags |
string | string | names, paths (not std::string) |
void | no return annotation | procedures |
func | (...any) -> any | callbacks / lambdas |
auto | inferred | new, GetService, datatype ctor |
Player / Folder | Player / Folder | Instance (class name) |
array<T> / LuaArray<T> / vector<T> / span<T> | {T} | arrays |
dictionary<K, V> | { [K]: V } | tables / maps |
optional<T> | T? | missing value |
const / static constexpr | Luau const | immutable |
null | nil | absence |
Vector3 CFrame UDim2 Color3 | same names | datatypes (copy) |
Enum.Material.Plastic | Enum.Material.Plastic | enums |
Examples:
int coins = 100;float speed = 16.5;string name = "Kartz";bool isActive = true;func callback = func () {};auto dynamicVal = DataService.Server;Player playerRef = null;Always initialize: int coins = 0; — int coins; emits nil.
There is no delete, no address-of, and no ->. Numbers copy; Instances mutate through . (property and instance method).
Instances are class names
Section titled “Instances are class names”Player player is an Instance of class Player. Properties and instance methods use .. Protected calls use :. Static names use ::. match arms write Part p =>.
player.Name = "Kartz";player.FindFirstChild("leaderstats");player.Name = "Kartz"player:FindFirstChild("leaderstats")There is no pointer arithmetic and no std::unique_ptr. Lifetime is Roblox’s: Destroy or Janitor.
Inferred when the value is new Class(...), GetService<T>(), or a datatype constructor. Prefer an explicit type on parameters and struct fields.
static_cast<T>(x), const_cast, reinterpret_cast, and dynamic_cast emit the argument. (void)x; disappears (silences unused in clangd). Luau has no casts — they do not check ClassName.