[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: __tonumber metamethod (was Re: Exposure of nil to end-users)
- From: Doug Currie <doug.currie@...>
- Date: Thu, 5 Feb 2009 13:23:02 -0500
On Feb 5, 2009, at 1:04 PM, Michal Kolodziejczyk wrote:
Doug Rogers wrote:
Michal Kolodziejczyk wrote:
I am also missing __tonumber metamethod...
It seems like this could be a useful feature, but if it were to
like __tostring it would be of limited value - limited to programmers
calling tonumber() explicitly.
Yes, I am aware of that, and this is what I meant - use __tonumber
when explicity calling tonumber() (and maybe adding an optional number
base as a second argument to __tonumber). I did not mean to change the
internals of VM (as I also appreciate the simplicity of lua).
One place where calling the __tonumber method implicitly would be
very useful is in string.format when given a numeric format option.