generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

number VS integer

Previous Thread :: Next Thread 
ZizZazZuz is not online. ZizZazZuz
Joined: 16 Jun 2008
Total Posts: 2743
25 Jan 2012 09:50 AM
How do I tell wether or not a number is an integer or a number? Integer being a subset of number.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Jan 2012 10:02 AM
Ignoring your explanation..

function check(n)
if n == (math.floor(n) and math.abs(n)) then
print(n.." is an integer and a whole number")
elseif n == math.floor(n) then
print(n.." is an integer.")
end
end
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
25 Jan 2012 10:19 AM
function check(n)
if n==math.floor(n) then
print("int")
else
print("number")
end
end
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
25 Jan 2012 10:50 AM
Whole numbers: 0,1,2,3,4,5,6...
Integers: ...-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6...

All whole numbers are integers.

Checking for an integer:
num == math.floor(num)

Checking for a whole number (also an integer):
num == (math.abs(num) and math.floor(num))
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image