Class that Contains an object, can it be done?

I tried something like:

WorldObj = class(obj, …)

function WorldObj:init()
for o=1, #vargs do
if not vargs[objName] then
self.objs[vargs[objName]] = vargs[obj]
end
end
end

– however, I can’t figure it out.
– inheritance is not a problem figuring out. But not everything “is-a” object. What of “has-a” or “contains-a” object classes?

I’m not sure what you’re trying to do exactly, but Ill try to help anyway. Are you trying to store a class within a class? This is fairly easy. Here’s an example:

classA = class()
classB = class()

function classB:init()
     -- code here
end

function classA:init()
    self.c = classB()
end

(I haven’t used classes in a while, so my bad if it doesn’t work properly)
My other guess is that you’re trying to store a table in a class or something. Here’s another example:

C = class()
function C:init()
    self.tab = { } -- table stored in a class
end

Sorry if I hadn’t helped you. :confused:
Edit: I have changed a bit of the top code.