lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, 16 Jul 2003 17:22:36 -0500
RLake@oxfam.org.pe wrote:

[...something other than what I wanted because I asked so unclearly...]

Given the code from the page in the comment...

  -- http://lua-users.org/wiki/LuaClassesWithMetatable

  function Class(members)
     members = members or {}
     local mt = {
        __metatable = members;
        __index     = members;
     }
     local function new(_, init)
        return setmetatable(init or {}, mt)
     end
     local function copy(obj, ...)
        local newobj = obj:new(unpack(arg))
        for n,v in pairs(obj) do newobj[n] = v end
        return newobj
     end
     members.new  = members.new  or new
     members.copy = members.copy or copy
     return mt
  end

...how can it be extended so that classes can have parents.  If it's
already there, I don't see it.

Thanks,
Steve