lua-users home
lua-l archive

Re: Matter of class/instance form/function...

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


steve donovan escribió: [On 9/18/07, David Manura <dm.lua@math2.org> wrote:
Duck wrote:
 
 setmetatable(t,{__index=c})
 
There's an implementation of the third way in
http://lua-users.org/wiki/SimpleLuaClasses,
showing how inheritance etc works. There are some interesting
trade-offs, but it definitely makes sense to have a metatable
corresponding to the 'class' object of other languages like Smalltalk
and Python - that is, a metatable shared by all instances of that
class type.
steve d.
 
There's also this library I wrote, inspired in SimpleLuaClasses. It adds multiple inheritance, both standard and virtual (C++ style).

http://lua-users.org/wiki/MultipleInheritanceClasses

-- HE

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