<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=String</id>
	<title>String - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.starfall.wtf/index.php?action=history&amp;feed=atom&amp;title=String"/>
	<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=String&amp;action=history"/>
	<updated>2026-07-28T16:13:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.starfall.wtf/index.php?title=String&amp;diff=480&amp;oldid=prev</id>
		<title>PRG: Created page with &quot;{{CatUp|Properties}} __TOC__  == Introduction ==  Strings are sequences of characters, letters, numbers, letters AND numbers, symbols, and so forth.    A script of   &lt;pre&gt; x = &quot;Hi mom&quot; y = &quot;123456&quot; z = &quot;Bob12345&quot; n = &quot;abc!@#$%^&amp;*()123456789&quot;  print (x) print (y) print (z) print (n) &lt;/pre&gt;  will print in the output bar Hi mom, 123456, Bob12345, and abc!@#$%^&amp;*()123456789 .  &lt;b&gt;Strings&lt;/b&gt; differ from Numbers in that you can&#039;t allocate a name like &quot;Bob&quot; to numbers....&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.starfall.wtf/index.php?title=String&amp;diff=480&amp;oldid=prev"/>
		<updated>2024-12-10T22:12:41Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{CatUp|Properties}} __TOC__  == Introduction ==  Strings are sequences of characters, letters, numbers, letters AND numbers, symbols, and so forth.    A script of   &amp;lt;pre&amp;gt; x = &amp;quot;Hi mom&amp;quot; y = &amp;quot;123456&amp;quot; z = &amp;quot;Bob12345&amp;quot; n = &amp;quot;abc!@#$%^&amp;amp;*()123456789&amp;quot;  print (x) print (y) print (z) print (n) &amp;lt;/pre&amp;gt;  will print in the output bar Hi mom, 123456, Bob12345, and abc!@#$%^&amp;amp;*()123456789 .  &amp;lt;b&amp;gt;Strings&amp;lt;/b&amp;gt; differ from &lt;a href=&quot;/index.php?title=Numbers&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Numbers (page does not exist)&quot;&gt;Numbers&lt;/a&gt; in that you can&amp;#039;t allocate a name like &amp;quot;Bob&amp;quot; to numbers....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{CatUp|Properties}}&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
Strings are sequences of characters, letters, numbers, letters AND numbers, symbols, and so forth.  &lt;br /&gt;
&lt;br /&gt;
A script of &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x = &amp;quot;Hi mom&amp;quot;&lt;br /&gt;
y = &amp;quot;123456&amp;quot;&lt;br /&gt;
z = &amp;quot;Bob12345&amp;quot;&lt;br /&gt;
n = &amp;quot;abc!@#$%^&amp;amp;*()123456789&amp;quot;&lt;br /&gt;
&lt;br /&gt;
print (x)&lt;br /&gt;
print (y)&lt;br /&gt;
print (z)&lt;br /&gt;
print (n)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will print in the output bar Hi mom, 123456, Bob12345, and abc!@#$%^&amp;amp;*()123456789 .  &amp;lt;b&amp;gt;Strings&amp;lt;/b&amp;gt; differ from [[Numbers]] in that you can&amp;#039;t allocate a name like &amp;quot;Bob&amp;quot; to numbers.  &lt;br /&gt;
&lt;br /&gt;
Another important note with strings is that if you try to perform arithmetic on a string value, it will try to convert the string to a number.  If your value can&amp;#039;t be converted to a number, you will get an error.&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&lt;br /&gt;
print (&amp;quot;5&amp;quot;+1)&amp;lt;br&amp;gt;&lt;br /&gt;
6&amp;lt;br&amp;gt;&lt;br /&gt;
print (&amp;quot;whoops&amp;quot;+1)&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;font color=&amp;quot;red&amp;quot;&amp;gt;Cmd:1: attempt to perform arithmetic on a string value&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the first example, &amp;quot;5&amp;quot; was converted from a string to a number (notice &amp;quot;5&amp;quot; was in quotes, but 1 was not.)&lt;br /&gt;
In the second example &amp;quot;whoops&amp;quot; could not be converted to a number, because it was a word.&lt;br /&gt;
&lt;br /&gt;
Although lua will convert strings with arithmetic (+, -, *, /), it won&amp;#039;t automatically convert strings with comparisons.  You have to convert a string to a number manually (or a number to a string) using the tonumber() or tostring() function:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(&amp;quot;50&amp;quot; == 50) -- false, because a string is not equal to a number.&lt;br /&gt;
print(tostring(50) == &amp;quot;50&amp;quot;)   -- true, because you converted the number 50 to a string&lt;br /&gt;
print(tonumber(&amp;quot;50&amp;quot;) == 50)   -- true, because you converted the string &amp;quot;50&amp;quot; to a number&lt;br /&gt;
print(50 .. &amp;quot;&amp;quot; == &amp;quot;50&amp;quot;)       --[[ true, because you tacked on an empty &lt;br /&gt;
string to the end of the number 50, converting 50 to a string.--]]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Advanced ==&lt;br /&gt;
&lt;br /&gt;
This will also work with [[hexadecimal]] numbers:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(0xf == 15) -- true, because 0xf is a hexadecimal number which equals 15&lt;br /&gt;
print(tonumber(&amp;quot;0xf&amp;quot;) == 15)   -- true, because you converted the string &amp;quot;0xf&amp;quot; to a number, 0xf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as well as with other based numbers, but you have to specify the base:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(tonumber(&amp;quot;00001111&amp;quot;,2)) -- prints 15&lt;br /&gt;
print(tonumber(&amp;quot;00001111&amp;quot;,2)==15) -- prints true&lt;br /&gt;
&lt;br /&gt;
print(tonumber(&amp;quot;774&amp;quot;,8)) -- prints 508&lt;br /&gt;
print(tonumber(&amp;quot;774&amp;quot;,8)==508) -- prints true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Quotes ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print &amp;quot;hello&amp;quot;&lt;br /&gt;
print &amp;#039;hello&amp;#039;&lt;br /&gt;
print [[hello]]&lt;br /&gt;
print (&amp;quot;hello&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will all result in:&lt;br /&gt;
hello [http://lua-users.org/wiki/StringsTutorial]&lt;br /&gt;
&lt;br /&gt;
This will allow you to nest a string within another string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(&amp;#039;hello &amp;quot;Lua user&amp;quot;&amp;#039;)&lt;br /&gt;
print(&amp;quot;Its [[content]] hasn&amp;#039;t got a substring.&amp;quot;)&lt;br /&gt;
print([[Let&amp;#039;s have more &amp;quot;strings&amp;quot; please.]])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will result in:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hello &amp;quot;Lua user&amp;quot;&lt;br /&gt;
Its [[content]] hasn&amp;#039;t got a substring.&lt;br /&gt;
Let&amp;#039;s have more &amp;quot;strings&amp;quot; please.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Multiline quotes ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print([[Multiple lines of text&lt;br /&gt;
can be enclosed in double square&lt;br /&gt;
brackets.]])&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Will result in:&lt;br /&gt;
Multiple lines of text can be enclosed in double square brackets.&lt;br /&gt;
&lt;br /&gt;
An example could be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
local m = Instance.new(&amp;quot;Message&amp;quot;) &lt;br /&gt;
m.Parent = game.Workspace&lt;br /&gt;
m.Text = [[Multiple lines of text &lt;br /&gt;
can be enclosed &lt;br /&gt;
in double square brackets.]]&lt;br /&gt;
wait(5) &lt;br /&gt;
m:Remove() &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Nesting quotes===&lt;br /&gt;
&lt;br /&gt;
Nested quotes rely on the use of equals signs to distinguish one nested quote from another.:&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print([=[one [[two]] one]=])&lt;br /&gt;
print([===[one [[two]] one]===])&lt;br /&gt;
&lt;br /&gt;
Both result in:&lt;br /&gt;
[one [[two]] one]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See Also ==&lt;br /&gt;
&lt;br /&gt;
[http://www.lua.org/pil/2.4.html Programming in Lua 2.4 -- Strings]&lt;br /&gt;
&lt;br /&gt;
[http://www.lua.org/manual/5.1/manual.html Lua 5.1 Reference Manual]&lt;br /&gt;
&lt;br /&gt;
[http://lua-users.org/wiki/StringsTutorial StringsTutorial]&lt;br /&gt;
&lt;br /&gt;
[[StringValue]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Properties]]&lt;/div&gt;</summary>
		<author><name>PRG</name></author>
	</entry>
</feed>