lua-users home
lua-l archive

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


David Demelier wrote:
Hi,

As we have already discussed this, some of us on the lists think that
math.isfloat is great but should also reflect the opposite as
math.isinteger.

Joseph Manning and I thought this idea great as you only need to
remember there are math.is* to check the type. So you don't need to
think which one of the function is available.

This makes the library clear and adds a symmetry to the API.

However Thijs Schreijer also thougth about the functione type() that
should returns two values like this:

type(10) ->  "number", "integer"
type(10.0) ->  "number", "float"

What about math.type( 10 )   -> "integer"
           math.type( 10.0 ) -> "float"
           math.type( "foo" ) -> string
           etc...

Or just return nil for not numbers..

Ralph