lua-users home
lua-l archive

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


> 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

-- 
Computers are useless. They can only give you answers.
                -- Pablo Picasso

-- 
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'