A high-performance class manager with annotations.
---@class Object: Class
local Object = class:extend()Templates represent the data structure of class objects. Classes are uninstantiable if no template is defined.
---@param x number
---@param y number
---@param z number
function Object:template(x, y, z)
self.position = vector(x, y, z)
self.orientation = quaterion(1, 0, 0, 0)
endIf a class inherits from another, templates can be written like this:
---@class Sphere: Object
local Sphere = Object:extend()
function Sphere:template()
Object.template(self)
self.radius = 5
endMerged classes are classes that inherit from multiple other classes. If class A and class B share field X, the new class obtains field X of class B, if it is the last passed class.
---@class Engine: Object
local Engine = Object:extend()
-- ...
---@class Wheels: Object
local Wheels = Object:extend()
-- ...
---@class Car: Engine, Wheels
local Car = class.merge(Engine, Wheels)
function Car:template()
Object.template(self)
Engine.template(self)
Wheels.template(self)
endlocal car = Car:new()