lua-users home
lua-l archive

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


On 11/21/2011 08:47 AM, Eduardo Ochs wrote:
> Hello!
> 
> This is an announcement for the latest & greatest version of my OO
> system for Lua: "eoo.lua", at:
> 
>   http://angg.twu.net/dednat5/eoo.lua.html
>   http://angg.twu.net/dednat5/eoo.lua
> 
> Its core, in 5 lines of code, hasn't changed since the last release,
> but now its documentation has fantastic box drawings,
> ...

Looks good, though I have a couple of practical questions about it. A
common idiom in OOP is polymorphic overriding of functionality, that
involves making a chain of calls back to the base class. In a Object ->
Sprite -> Monster tree of inheritance, this kind of thing would happen:

function Monster:foo(x, y, z)
  Sprite.foo(self, x, y)
  self.z = z
end

function Sprite.foo(x, y)
  Object.foo(self, x)
  self.y = y
end

function Object.foo(x)
  self.x = x
end

Is that how you would recommend doing it in your object system?