Split

From Multi Theft Auto: Wiki
Revision as of 20:51, 13 June 2006 by MrJax (talk | contribs)
Jump to navigation Jump to search

This function splits a string into sub-strings. You specify a character that will act as a separating character; this will determine where to split the sub-strings.

Returns

Returns a table of the sub-strings.

Syntax

table split ( string, separatingchar )

Example

function onPlayerChat ( player, chat )
 if (split (chat, 1, " ")) == "!createhydra")
   x, y, z = getPlayerPosition ( player )
   createVehicle ( 520, x + 5, y, z )
   outputChatBox ( "You got a hydra", player )
 end
end

See Also