qOOP is a simple and quick-written Lua Library which offers some
OOP facilities using
Lua Programming Language.
It is highly simply-written, compact, powerful, effective.
qOOP is still in development stage and may bring new features.
Current Features
- Class creation
- Static class
- Final class
- Single Inheritance
- Multiple Inheritance
- Instantiation with class() call (features named arguments too)
- Some library defined functions to manipulate objects/classes
A simple usage example require 'qoop.qoop'
-- Create a single class named Hero
Hero = class():has {x = 10, y = 10, life = 100}
-- We may also add some methamethods to Hero class
function Hero:moveX(step)
self.x = self.x + step
end
function Hero:moveY(step)
self.y = self.y + step
end
-- Now we can instantiate from class Hero
albert = Hero()
albert:moveX(1)
albert:moveY(2)
print('albert',albert.x, albert.y)
-- we can also instantiate a new Hero and set its parameters at the same time
albert = Hero {x = 15, y = 15}
print('albert',albert.x, albert.y)