<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://hotline.ubersoft.org/Sputnik/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://hotline.ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_Serialize</id>
		<title>Core Function Serialize - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://hotline.ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_Serialize"/>
		<link rel="alternate" type="text/html" href="http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;action=history"/>
		<updated>2026-04-05T14:38:26Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5745&amp;oldid=prev</id>
		<title>UberFoX: /* Remarks */</title>
		<link rel="alternate" type="text/html" href="http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5745&amp;oldid=prev"/>
				<updated>2015-06-22T11:29:41Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Remarks&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:29, 22 June 2015&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The serializer in Sputnik shares some similarities with the one with PHP in terms of how it lays out the value this means simple types like *String* may convert to PHP but more complex types like Arrays etc will not.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The serializer in Sputnik shares some similarities with the one with PHP in terms of how it lays out the value this means simple types like *String* may convert to PHP but more complex types like Arrays etc will not.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;If you are unserializing a string that contains a class and a class with that name cannot be located it will create an instance of IncompleteClass instead you can check for this by doing:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;IsVarClass($a, 'IncompleteClass');&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/pre&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Example ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Example ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	<entry>
		<id>http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5728&amp;oldid=prev</id>
		<title>UberFoX: /* Remarks */</title>
		<link rel="alternate" type="text/html" href="http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5728&amp;oldid=prev"/>
				<updated>2015-06-21T10:01:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Remarks&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 10:01, 21 June 2015&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;To read this in another language you would need to first read it into Sputnik then dump it as JSON.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;To read this in another language you would need to first read it into Sputnik then dump it as JSON.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;It is worth noting that Sputniks serializer has been *finalized* and will not change in the future however new data types may be added to it making older versions of Sputnik unable to unserialize something from a newer version.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;The serializer in Sputnik shares some similarities with the one with PHP in terms of how it lays out the value this means simple types like *String* may convert to PHP but more complex types like Arrays etc will not.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Example ===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Example ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	<entry>
		<id>http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5726&amp;oldid=prev</id>
		<title>UberFoX: Created page with &quot;&lt;pre&gt; Serialize( &lt;variable&gt; ) &lt;/pre&gt;  === Description ===  Convert a variable, array, class etc a string you can save to file or transfer over the internet.  === Parameters ===  ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://hotline.ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_Serialize&amp;diff=5726&amp;oldid=prev"/>
				<updated>2015-06-21T09:57:46Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; Serialize( &amp;lt;variable&amp;gt; ) &amp;lt;/pre&amp;gt;  === Description ===  Convert a variable, array, class etc a string you can save to file or transfer over the internet.  === Parameters ===  ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
Serialize( &amp;lt;variable&amp;gt; )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
Convert a variable, array, class etc a string you can save to file or transfer over the internet.&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
==== variable ====&lt;br /&gt;
&lt;br /&gt;
The variable to serialize.&lt;br /&gt;
&lt;br /&gt;
=== Return Value ===&lt;br /&gt;
&lt;br /&gt;
Success: Returns serialized variable.&lt;br /&gt;
&lt;br /&gt;
Failure: Returns null.&lt;br /&gt;
&lt;br /&gt;
=== Remarks ===&lt;br /&gt;
&lt;br /&gt;
This can be used as a very fast effective way to dump arrays/classes to a file and read it back later.&lt;br /&gt;
&lt;br /&gt;
It is faster than the JSON stuff however it is not as portable and will only work within Sputnik.&lt;br /&gt;
&lt;br /&gt;
To read this in another language you would need to first read it into Sputnik then dump it as JSON.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Serialize a string&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Make a value&lt;br /&gt;
$a = &amp;quot;Hello&amp;quot;;&lt;br /&gt;
// Serialize it&lt;br /&gt;
my $s = Serialize($a);&lt;br /&gt;
// Print the serialized&lt;br /&gt;
say $s;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// p:5:&amp;quot;Hello&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
// Unserialize is&lt;br /&gt;
my $b = Unserialize($s);&lt;br /&gt;
// Print it&lt;br /&gt;
say $b;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// Hello&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Serialize a number&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Make a value&lt;br /&gt;
$a = 777;&lt;br /&gt;
// Serialize it&lt;br /&gt;
my $s = Serialize($a);&lt;br /&gt;
// Print the serialized&lt;br /&gt;
say $s;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// l:777;&lt;br /&gt;
&lt;br /&gt;
// Unserialize is&lt;br /&gt;
my $b = Unserialize($s);&lt;br /&gt;
// Print it&lt;br /&gt;
say $b;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// 777&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Serialize an array&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Make an array&lt;br /&gt;
// Note - You could include multiple arrays inside arrays and so on&lt;br /&gt;
$a = array(100, &amp;quot;Cat&amp;quot;, &amp;quot;Dog&amp;quot;);&lt;br /&gt;
// Serialize it&lt;br /&gt;
my $s = Serialize($a);&lt;br /&gt;
// Print the serialized&lt;br /&gt;
say $s;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// a:l:3;l:0;l:3;i:0;:{l:0;l:100;l:1;p:3:&amp;quot;Cat&amp;quot;;l:2;p:3:&amp;quot;Dog&amp;quot;;}&lt;br /&gt;
&lt;br /&gt;
// Unserialize is&lt;br /&gt;
my $b = Unserialize($s);&lt;br /&gt;
// Print it&lt;br /&gt;
printr $b;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// Array&lt;br /&gt;
// (&lt;br /&gt;
//     [0] =&amp;gt; 100&lt;br /&gt;
//     [1] =&amp;gt; Cat&lt;br /&gt;
//     [2] =&amp;gt; Dog&lt;br /&gt;
// )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Serialize a class&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// Make a Class&lt;br /&gt;
Class Test&lt;br /&gt;
{&lt;br /&gt;
	my $cat;&lt;br /&gt;
	my $dog;&lt;br /&gt;
	// This function is called when you create a class&lt;br /&gt;
	Function __Construct($catGoes, $dogGoes)&lt;br /&gt;
	{&lt;br /&gt;
		$cat = $catGoes;&lt;br /&gt;
		$dog = $dogGoes;&lt;br /&gt;
		say &amp;quot;Class 'Test' made&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
	// This function is called when you serialize a class&lt;br /&gt;
	Function __Sleep()&lt;br /&gt;
	{&lt;br /&gt;
		say &amp;quot;Class 'Test' sleeps&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
	// This function is called when you unserialize a class&lt;br /&gt;
	Function __WakeUp()&lt;br /&gt;
	{&lt;br /&gt;
		say &amp;quot;Class 'Test' woken up&amp;quot;;&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
// Create class instance&lt;br /&gt;
$a = new Test('meow', 'woof');&lt;br /&gt;
// Serialize it&lt;br /&gt;
my $s = Serialize($a);&lt;br /&gt;
// Print the serialized&lt;br /&gt;
say $s;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// oc:p:4:&amp;quot;test&amp;quot;;{a:l:2;l:0;l:0;i:2;:{p:3:&amp;quot;cat&amp;quot;;p:4:&amp;quot;meow&amp;quot;;p:3:&amp;quot;dog&amp;quot;;p:4:&amp;quot;woof&amp;quot;;}}&lt;br /&gt;
&lt;br /&gt;
// Unserialize is&lt;br /&gt;
my $b = Unserialize($s);&lt;br /&gt;
// Print it&lt;br /&gt;
printr $b;&lt;br /&gt;
// PRINTS&lt;br /&gt;
// test Class&lt;br /&gt;
// (&lt;br /&gt;
//     [cat] =&amp;gt; meow&lt;br /&gt;
//     [dog] =&amp;gt; woof&lt;br /&gt;
// )&lt;br /&gt;
&lt;br /&gt;
// Lets double check it worked by calling the classes variables&lt;br /&gt;
say &amp;quot;Cat goes? : &amp;quot; . $b-&amp;gt;$cat;&lt;br /&gt;
say &amp;quot;Dog goes? : &amp;quot; . $b-&amp;gt;$dog;&lt;br /&gt;
&lt;br /&gt;
// PRINTS&lt;br /&gt;
// Cat goes? : meow&lt;br /&gt;
// Dog goes? : woof&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Core Function]]&lt;/div&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	</feed>