<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Spenkbang</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Spenkbang"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Spenkbang"/>
	<updated>2026-05-06T06:50:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Gettok&amp;diff=62260</id>
		<title>Gettok</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Gettok&amp;diff=62260"/>
		<updated>2019-02-20T12:48:37Z</updated>

		<summary type="html">&lt;p&gt;Spenkbang: Undo revision 55324 by Pirulax (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function splits a string using the given separating character and returns one specified substring.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string gettok ( string text, int tokenNumber, string / int separatingCharacter )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''text:''' the string that should be split.&lt;br /&gt;
*'''tokenNumber:''' which token should be returned (1 for the first, 2 for the second, and so on).&lt;br /&gt;
*'''separatingCharacter:''' the [[ASCII|ASCII number]] representing the character you want to use to separate the tokens. You can easily retrieve this by running string.byte on a string containing the separating character.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[string]] containing the token if it exists, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example retrieves the startskin and endskin for spawning a player from a string of two numbers &amp;quot;a,b&amp;quot;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Put the string with the skins in a variable. Normally you would read it from a .map file or something.&lt;br /&gt;
local skins = &amp;quot;20,30&amp;quot;&lt;br /&gt;
-- Get the startskin and endskin strings (&amp;quot;20&amp;quot; and &amp;quot;30&amp;quot; in this case)&lt;br /&gt;
local startskin = gettok ( skins, 1, ',')&lt;br /&gt;
local endskin = gettok ( skins, 2, ',' )&lt;br /&gt;
-- Get a random skin in the range&lt;br /&gt;
local skin = math.random ( tonumber(startskin), tonumber(endskin) )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Utility functions}}&lt;/div&gt;</summary>
		<author><name>Spenkbang</name></author>
	</entry>
</feed>