lua-users home
lua-l archive

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


Is there any reason for the __len metamethod to reduce only allow returning a single value ?
The pseudo code in the manual :
         if h then
           -- call the handler with the operand
           return h(op)
doesn't seems to do this adjustement.

I actually write a matrix object in lua, and when implementing the __len metamethod, I want to return two values, the number of row and the number of col. But lua remove the second return value.

Is it ok too remove this limitation, or does this have some not so nice side-effects ?

Tom
--
Thomas Lavergne                       "Le vrai rêveur est celui qui rêve
                                       de l'impossible."  (Elsa Triolet)
thomas.lavergne@reveurs.org                           http://reveurs.org