Squirrel/Server/Functions/Utils/IsNum
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ This function returns whether the string is a number == Syntax == <code>bool IsNum( string text )</code> == Arguments == * '''text''' - This is the string to check == Exampl...) |
Revision as of 15:36, 17 October 2008
This function returns whether the string is a number
Syntax
bool IsNum( string text )
Arguments
- text - This is the string to check
Example
This example tells the player if their input is a number when they type '/numbertest 123'
function OnPlayerCommand( id, cmd, text ) { if ( cmd == "numbertest" ) { if ( IsNum( text ) ) MessagePlayer( text + " is a number!", id ); else MessagePlayer( text + " is NOT a number!", id ); } }
Notes
The call OnPlayerCommand was used in in this example. More info about this in the corresponding page.