Squirrel/Server/Functions/Utils/GetTok

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Squirrel/Title|GetTime}} {{Squirrel/Deprecated|It is recommended that Squirrel's [http://squirrel-lang.org/doc/sqstdlib3.html#d0e1913 system library function], time() be use...")
 
 
Line 1: Line 1:
{{Squirrel/Title|GetTime}}
+
{{Squirrel/Title|GetTok}}
{{Squirrel/Deprecated|It is recommended that Squirrel's [http://squirrel-lang.org/doc/sqstdlib3.html#d0e1913 system library function], time() be used instead.}}
+
 
This function get one word from the string provided (e.g: Hi, i'm a string)
 
This function get one word from the string provided (e.g: Hi, i'm a string)
  

Latest revision as of 11:36, 26 August 2014

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function get one word from the string provided (e.g: Hi, i'm a string)

[edit] Syntax

  1. GetTok ( parameter szParams, string ToJump, int Number )

[edit] Example

This example tells the player the toks "Hi," and "string!"

  1.  
  2. function onPlayerCommand ( pPlayer, szCommand, szParams ) {
  3.  
  4. switch ( szCommand ) {
  5.  
  6. case "toks": {
  7.  
  8. local String = "Hi, i'ma a string! :D";
  9.  
  10. local One = GetTok ( String, " ", 1 ); // Get "Hi,"
  11. local Two = GetTok ( String, " ", 4 ); // Get "string!"
  12.  
  13. MessagePlayer ( One + Two, pPlayer );
  14. }
  15. }
  16. }
  17.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox