API:Class

function Class(name, super) super = super or UIRoot class = { super = super, name = name, methods = {} }

-- if class slot unavailable, check super class -- if applied to argument, pass it to the class method new setmetatable(class, {   __index = super,    __call  = function(self,...) return self:new(...) end  })

setmetatable(class.methods, {   -- if instance method unavailable, check method slot in super class        __index     = class.super.methods,    -- when defining a new method, set the environment for proper, static, class access and super-method access    __newindex  = function (c, m, f)      if (class.super.methods[m]) then        setfenv(f, setmetatable({__class = class, __super = class.super.methods[m]}, {__index = getfenv(f) }))      else        setfenv(f, setmetatable({__class = class}, {__index = getfenv(f) }))      end      rawset(c,m,f)    end  })

return class end

TFrame=Class("TFrame",TLayout);