lua-template
-- if this lua file gets included in multiple lua scripts this revents it from being recreated over and over again
if ClassName ~= nil then return end

-- define your class name
ClassName = {}

-- this is where you init things about the class
function ClassName:Create()
    -- create a table that we'll return from this class so the user can work with it
    local obj = {}

    -- example of how to define class/table variables
    obj.test = 5

    -- this assigns all the functions defined below to this table object above
    local k,v
    for k,v in pairs(ClassName) do
        obj[k] = v
    end

    -- return the table so the player can call the functions and access variables
    return obj
end

-- example of how to define a "class"/table function
function ClassName:Update()
end

-- another example of a table/class function
function ClassName:PostRender(context)
end
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License