I just started getting back into Lua and I decided to try and write my own class library based on ones made by other people (rxi and recursor specifically). So far I have this:
local Class = {}
Class.__index = Class
function Class:new()
local obj = setmetatable({}, self)
obj['__call'] = self.__call
obj.__index = obj
return obj
end
function Class:__call(...)
local obj = setmetatable({}, self)
obj:load(...)
return obj
end
return Class
But from looking at the implementations of the people mentioned above, they have something like this in Class:new() as well as an initialization function at the top of the file with nothing in it.