lua-users home
lua-l archive

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


steve donovan wrote:
> On a another note, it would be cool if there were __tostring and
> __tonumber metamethods. Then defining such a NULL proxy object is
> really easy.  It still retains its identity as NULL (i.e. it isn't
> really 0 or "") but can have safe default behaviour.

I am also missing __tonumber metamethod (if there is __tostring
corresponding to tostring(), why there is no __tonumber corresponding to
tonumber()?) in more general cases, i.e. not only for NULL object, but
for my own object for which I would like to get its value (with
tonumber()) or its description (with tostring()).

So for me, __tonumber metamethod would be really helpful.

Regards,
miko