lua-users home
lua-l archive

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


On Sun, Jul 7, 2013 at 2:46 PM, Luis Carvalho <lexcarvalho@gmail.com> wrote:
>> I just think that the math library lacks of a isinteger function.
>
> Lua 5.3.0 (work1)  Copyright (C) 1994-2013 Lua.org, PUC-Rio
> lua53> isinteger = function (x) return not math.isfloat(x) end
> lua53> = isinteger(1)
> true
> lua53> return  isinteger(1.0)
> false
> lua53> return  isinteger(math.floor(1))
> false
> lua53> return  isinteger(math.ifloor(1.0))
> true
>
> Cheers,
> Luis

= isinteger("x")

What does this return? I don't have 5.3 handy at the moment.

/s/ Adam