Making a class using Lua is pretty gross and requires underlying knowledge about how metatables work and other nonsense. Anyway, I made a function to automate the process.

Example:
Code:
Person = class()

function Person:__init(name, age)
    self.name = name
    self.age = age
end

newPerson = Person("Bob", 41)
Instead of defining a constructor like you normally would, class() creates one for you and then calls __init when the class is created. (Defining __init is optional though.) Also, you now just call the name of the class instead of explicitly calling the constructor, which is how it works in most OO languages. class() also takes an optional argument for a superclass from which to inherit from. (Right now there is not multiple-inheritance because that would take a lot more effort on my part. )

Here's the definition for class():
Code:
function class(superclass, name)
    local cls = superclass and superclass() or {}
    cls.__name = name or ""
    cls.__super = superclass
    return setmetatable(cls, {__call = function (c, ...)
        self = setmetatable({__class = cls}, cls)
        if cls.__init then
            cls.__init(self, ...)
        end
        return self
    end})
end
I hope your brain didn't explode.