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
 

Re: Check if its a number

Previous Thread :: Next Thread 
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 05:24 PM
I forgot how to check if something is a number >.>

Like the name of something or a variable

a = 1 + 1

if tonumber(a) then



?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
06 Apr 2013 05:28 PM
Not sure...

I know there is probably a better way of doing this but...

IsNum = function(num)
return pcall(function()
local Bob = num + 1
end)
end

if IsNum(a) then
print("Yay"_
end
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
06 Apr 2013 05:28 PM
if tonumber(a) == a then
print(true)
end

Remove the floodcheck!
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
06 Apr 2013 05:29 PM
oops random underscore...
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 05:30 PM
if tonumber(string.sub(msg,1,1)) == string.sub(msg,1,1)

?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Apr 2013 05:45 PM
numbers = {"1",2","3","4","5,"6","7","8,"9"}

for _,v in pairs(numbers)

if string.sub(v, 1,9) then
---st00f
end



Idk if that will work :/
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
06 Apr 2013 05:47 PM
a = 1 + 1
if type(tonumber(a)) == "number" then

Or that,
Report Abuse
dennis96411 is not online. dennis96411
Joined: 06 Mar 2009
Total Posts: 1079
06 Apr 2013 06:33 PM
Probably a stupid way... but:
if not (string):match("%a") and not (string):match("%p") then
--blah blah
end

Checks for letters and some symbols.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
06 Apr 2013 06:57 PM
Bump to get rid of long named post.....
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