Squirrel/Server/Functions/Utils/IsNum

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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

  1. 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'

  1.  
  2. function OnPlayerCommand( id, cmd, text )
  3. {
  4. if ( cmd == "numbertest" )
  5. {
  6. if ( IsNum( text ) ) MessagePlayer( text + " is a number!", id );
  7. else MessagePlayer( text + " is NOT a number!", id );
  8. }
  9. }
  10.  

Notes

The call OnPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Template:Squirrel/Functions/Misc

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox