[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Data inheritance problem
- From: Steve Dekorte <steve@...>
- Date: Wed, 15 Nov 2000 15:17:08 -0800
Pete Gardner wrote:
>counter:child_inc() -- but this works on counter_base's data, not counter's...
> Am I overlooking something? Is this expected behaviour? How can I make
> child_inc() work on it's own data?
If you want it to work on the child you need to change:
function counter:child_inc() self.parent:inc() end
function counter:child_inc() self.parent.inc(self) end
or more simply:
function counter:child_inc() self:inc() end
If you implement a method lookup tag on your objects.