NumTok

From Liberty Unleashed Wiki
Revision as of 09:21, 13 January 2011 by Thijn (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 the number of tokens found in a string.

Syntax

  1. integer NumTok( String string, String separator )

Arguments

  • string - The string to search the token in
  • separator - The separator which will be counted in the string

Example

This command returns how many spaces a player used in a command.

  1.  
  2. function onPlayerCommand( plr, cmd, text )
  3. {
  4. if ( cmd == "spaces" )
  5. {
  6. if ( text )
  7. {
  8. MessagePlayer( "Your message contained " + NumTok( text, " " ) + " spaces.", plr );
  9. }
  10. }
  11. return 1;
  12. }
  13.  

Notes

The function MessagePlayer, and event onPlayerCommand were used in in this example. More info about these in the corresponding pages.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox