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...)
 
Line 27: Line 27:
 
=== Notes ===
 
=== Notes ===
  
The call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] was used in in this example. More info about this in the corresponding page.
+
The function [[Squirrel/Functions/Misc/MessagePlayer|MessagePlayer]] and call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] were used in in this example. More info about them in corresponding pages.
  
 
== Related Functions ==
 
== Related Functions ==
  
 
{{Squirrel/Functions/Misc}}
 
{{Squirrel/Functions/Misc}}

Revision as of 15:53, 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 function MessagePlayer and call OnPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Template:Squirrel/Functions/Misc

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox