Squirrel/Server/Functions/Utils/IsNum
From Liberty Unleashed Wiki
(Difference between revisions)
(Updated) |
m (Squirrel/Functions/Misc/IsNum moved to Squirrel/Server/Functions/Utils/IsNum: Moved to the right category) |
Revision as of 04:42, 13 November 2009
This function returns whether a 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( player, cmd, text ) { if ( cmd == "numbertest" ) { if ( IsNum( text ) ) MessagePlayer( text + " is a number!", player ); else MessagePlayer( text + " is NOT a number!", player ); } }
Notes
The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.