lua-users home
lua-l archive

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


2009/4/27 Evan DeMond <evan.demond@gmail.com>:
> Just to look at things another way, then, is it troubling that tonumber()
> isn't guaranteed to return a number?
> Not saying that I think that nil should be convertible to a numeric value,
> but I'd like to hear others' thoughts on that point. =)

If it were guaranteed to return a number there would be no way to
signal failure. You would need to have an isnumeric() to go along with
it, and then you might find that 'isnumeric(x) and tonumber(x)' would
become a common idiom =).

    Henk