lua-users home
lua-l archive

overriding method of a single object and calls its metatable method ?

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


Hi,
Given the following construct(as mentioned in PIL)
A={}
function A:new(o)
 local o=o or {}
 setmetatable(o,self)
 self.__index = self
end
function A:foo()
 print("foo of A")
end
a=A:new()
how can I easily define a method a.foo which is
equivalent to this :
function a.foo()
 a.super.foo()
 print("foo of a")
end
which has this output :
foo of A
foo of a
 
____________________________________________________________________________________
It's here! Your new message! 
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

AltStyle によって変換されたページ (->オリジナル) /