lua-users home
lua-l archive

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


First, best wishes to the lua-list!

I was playing around with the very good LOOP library of Renato Maia when I discovered that metamethods were not properly inherited. Consider this simplistic example:

local oo = require "loop.simple"
Shape = oo.class { __tostring = function() return "Shape" end }
Circle = oo.class({}, Shape) -- Circle derives from Shape
print(Shape()) -- print an instance of Shape
print(Circle()) -- print an instance of Circle

I would have expected:
     Shape
     Shape
... but I get:
     Shape
     table: 0035D5E0

Peeking at the code, I understand why this happens, but I can't think of a simple patch, which wouldn't break the design goal of dynamicity of Renato's library.
Does somebody have any idea how to solve this? Renato, maybe? :-)

Thanks a lot for your help and keep the good job in 2008,

Aladdin

_________________________________________________________________
Microsoft vous offre un logiciel pour classer, retoucher et partager vos photos !
http://www.windowslive.fr/galerie/