See if string is an integer?

How to check if a string is an integer?

I looked on garrysmod.com and couldn’t seem to find anything.

Thanks in advance,
Dizzymagoo

You can compare it using **[G.type

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.type)** .

For example

[lua]
if type(var) == “number” then
//yada yada
end
[/lua]

Perfect. Lol I was looking for like isnumeric. Haha I love PHP :slight_smile:

You could also check if you can turn it into a number:

[lua]

if( tonumber(var) != nil ) then

  //Stuff

end

[/lua]