[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: tonumber metamethod?
- From: Markus Fritsche <Fritsche.Markus@...>
- Date: Fri, 3 Jun 2005 10:29:05 +0000 (UTC)
Luiz Henrique de Figueiredo <lhf <at> tecgraf.puc-rio.br> writes:
> > is there any particular reason why there is a tostring but not a
> > tonumber metamethod?
> No reason, except that it never came up. What would you use a tonumber
> metamethod for?
Well, tonumber accepts only numbers like "42.23", not "1,042.23" or "1.032,42"
(german number format). Wouldn't be a tonumber-metamethod the right place for
this? Or is it cleaner to implement this in a function of its own?
Kind regards, Markus