[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: overriding method of a single object and calls its metatable method ?
- From: gary ng <garyng2000@...>
- Date: Sat, 3 Mar 2007 07:11:09 -0800 (PST)
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/