What is Classe?
Classe is a smart class wrapper for Luau. It automatically calculates object structures, including fields and methods, using advanced type functions. Furthermore, Classe optimizes metadata lookups, ensuring high performance even with deep inheritance hierarchies
Classe handles all the heavy lifting for you: metatables, __index, and type casting. You no longer need to manually define every object field for type checking, the module infers and handles it automatically
Class Example:
--!strict
local Gun = Classe.meta({ })
type Self = Classe.Self<typeof(Gun)>
function Gun.construct(self)
self.bullets = 10
return self
end
function Gun.shot(self: Self)
self.bullets -= 1 -- OK!
end
return Classe.build(Gun)
Inheritance Example:
--!strict
local Rifle, super = Classe.meta({}, Gun)
type Self = Classe.Self<typeof(Rifle)>
function Rifle.construct(self)
self.range = 10
super(self)
return self
end
function Rifle.aim(self: Self)
print("aiming...")
end
return Classe.build(Gun)
Creating an Object
local rifle = Rifle.new()
rifle:shot()




