Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I check if something is a decimal or not?

Asked by
lucas4114 607 Moderation Voter
8 years ago

Title says it all, so is there a way to do something like return false if a value is for example, 3 then return true if it's something like 2.37777777777?

1 answer

Log in to vote
2
Answered by 8 years ago

Yes. Something like this function should work:

function isInteger(n)
    return math.floor(n) == n
end
Ad

Answer this question