[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: OOP sortof
- From: Lucas Zawacki <lfzawacki@...>
- Date: Sat, 1 Jan 2011 19:10:57 -0200
Here's a variation of your code using closures to create private
fields https://gist.github.com/762006
Notice that it pretty much makes the a.foo(a,...) and a:foo(...)
unecessary but I left it to conform with your example.
Additional reading on the subject can be done here:
http://lua-users.org/wiki/ObjectOrientationClosureApproach
PS.:
steve code using _newindex is quite interesting! Lua once again
surprises me (in a good way :)