lua-users home
lua-l archive

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


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
to:
    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.

Steve