function class(base, init)
The Class interface
This function is used to generate class constructors that support
inheritance to allow more sophisticated object oriented design.
Inheritance allows using all methods in subclasses.
Attention: Fields will not be available in the subclass!
Example:
Constructor = class(
function(self, arg)
-- This is the actual constructor!
self.somevar = arg
end
)
ConstructorChild = class( Constructor,
function(self, arg)
self.somevar = arg
end
)
function Constructor:someMethod()
-- Do something!
end
Taken from: lua-users.org
class.lua
Compatible with Lua 5.1 (not 5.0).