lua-users home
lua-l archive

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


Zed A. Shaw wrote:
1) What's people's favored OO system for Lua and the advantages/disadvantages?

Well, I use Julien Patte's YACI (with my bugfix applied :-), available at

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

See the bottom of the page for the bugfix.

Good: you don't have to mess around with all that ugly setmetatable stuff, you get a magic constructor method (init()), and you get nice tidy access to superclass methods if you want to overload something.

Bad: *all* variables are protected a la C++, ie shared with all lower levels of the inheritance tree. If your superclass has a variable called state, you cannot have a subclass that also has a variable called state.

--
f r e y
live music with machines
http://www.frey.co.nz