I'm having a huge nightmare with these subclasses and I can't figure out why this isn't working.
I have main class BODY with a subclass RECTANGLE. BODY has a function called SetWorld which does the following
function BODY:SetWorld( worldnum )
self.world = worldnum
end
Now, if I do this:
rect = RECTANGLE:new()
rect:SetWorld(1)
The value self.world is changed to 1 in the SetWorld function but if I try to use self.world in another function in BODY it always returns nil. Why is this? It works if I create a new BODY instead of a RECTANGLE, but that means I can't use my subclass.
Thanks in advanced.