IsNum

From Liberty Unleashed Wiki
Revision as of 13:48, 13 July 2010 by Juppi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function returns whether a 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( player, cmd, text )
  3. {
  4. if ( cmd == "numbertest" )
  5. {
  6. if ( IsNum( text ) ) MessagePlayer( text + " is a number!", player );
  7. else MessagePlayer( text + " is NOT a number!", player );
  8. }
  9. return 1;
  10. }
  11.  

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox