[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OO in lua new style: inherit
- From: Scott Vokes <vokes.s@...>
- Date: Fri, 6 May 2011 14:49:15 -0400
2011/5/5 陶陶 <taozuhong@qq.com>:
> I have found a new OO style, it is very convenient, so share it for u, any
> suggestion is welcome.
This style of OOP is usually called "Prototype"-based programming
(see e.g. http://c2.com/cgi/wiki?PrototypeBasedProgramming), or
described as using prototypes rather than classes. You'll probably
find more info looking under that name. It's actually a pretty common
style in Lua. (I like it, too.)
Also, instead of Client:Print(...), you can use the __tostring
metatable hook.
Scott