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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 06 Apr 2013 06:57 PM |
| Bump to get rid of long named post..... |
|
|
| Report Abuse |
|
|