lua-users home
lua-l archive

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


Hi, i have some kind of mixed object hierarchy in lua and c, where objects and classes are tables.

I can overwrite a method in the hierarchy, but to call the overwritten method i have to do something
like this:

luz = TiLight {
   SetColor = function(self, r, g, b)
      self.parent.SetColor( self, r, g, b )
   end,
}

instead of "self.parent.SetColor( self, r, g, b )" my first idea was to do:

self.parent:SetColor( r, g, b )

but it doesn't work because the method needs the table of the child, parent table only contains
methods. This code is going to be written by non programmers so i would like to simplify it a bit,
maybe using a function call like:

self:Delegate( r, g, b )

but, can i get the name of the function that i have to call?
any other ideas on how to simplify that?


Ignacio Castano
castanyo@yahoo.es



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com