Types
CL++ is statically typed. clpp emits Luau with the same contracts. A type is what a value is allowed to be, and what you may do with it.
Primitive map
Section titled “Primitive map”| CL++ | Luau | Use for |
|---|---|---|
int, float, double | number | counts, damage, alpha |
bool | boolean | flags |
string | string | names, paths |
void | (no return) | procedures |
auto | inferred | when new or GetService makes the type obvious |
Player, Folder, … | Player, Folder | Instances (class names, never Player*) |
LuaArray<int> / array<T> / vector<T> | {number} | arrays (GetPlayers, inventory) |
optional<T> | T? | missing values (prefer null on Instances) |
Vector3, CFrame, UDim2 | same | datatypes |
int coins = 10;bool loaded = false;Folder folder = new Folder(player);local coins: number = 10local loaded: boolean = falselocal folder: Folder = Instance.new("Folder")folder.Parent = playerInstances are class names
Section titled “Instances are class names”Write Player player, not Player*. There is no ->, no address-of, no pointer arithmetic. Properties and instance methods use ..
player.Name = "Kartz";player.FindFirstChild("leaderstats");player.Name = "Kartz"player:FindFirstChild("leaderstats")Lifetime is Roblox’s: parented Instances live until Destroy or until a Sweep cleans them.
null is nil. Always test before using a FindFirstChild result:
auto stats = player.FindFirstChild("leaderstats");if (stats == null) { return;}Why types matter
Section titled “Why types matter”Typos, wrong arguments, and nil indexing are the majority of live-game bugs. --!strict plus CL++ types catch them in the editor. If a function takes Player, do not pass a string. If a value is const int, do not assign to it later.
Next: const and immutability.