<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Dump</id>
	<title>Dump - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kolmafia.us/index.php?action=history&amp;feed=atom&amp;title=Dump"/>
	<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Dump&amp;action=history"/>
	<updated>2026-04-25T03:25:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://wiki.kolmafia.us/index.php?title=Dump&amp;diff=8553&amp;oldid=prev</id>
		<title>Fredg1: create dump()</title>
		<link rel="alternate" type="text/html" href="https://wiki.kolmafia.us/index.php?title=Dump&amp;diff=8553&amp;oldid=prev"/>
		<updated>2020-09-20T23:19:58Z</updated>

		<summary type="html">&lt;p&gt;create dump()&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{&lt;br /&gt;
#vardefine:name|dump}}{{&lt;br /&gt;
#vardefine:return_type|void}}{{&lt;br /&gt;
&lt;br /&gt;
FunctionPage|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
&lt;br /&gt;
function1={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
parameter1={{Param|any|composite}}|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
function2={{Function|&lt;br /&gt;
name={{#var:name}}|&lt;br /&gt;
return_type={{#var:return_type}}|&lt;br /&gt;
parameter1={{Param|any|composite}}|&lt;br /&gt;
parameter2={{Param|string|color}}|&lt;br /&gt;
p1desc={{Pspan|composite}} is the variable to dump. Can be any data type (besides &amp;#039;&amp;#039;void&amp;#039;&amp;#039;), but the intended use is with [[Data_Types#aggregate|an aggregate]] or [[Data_Types#record|a record]].|&lt;br /&gt;
p2desc={{Pspan|color}} is an html color name or code. See [[print]] for more information.|&lt;br /&gt;
}}|&lt;br /&gt;
function_description=&amp;quot;Dumps&amp;quot; (i.e. &amp;quot;unfolds&amp;quot;, showing every key/field of the variable, and their value) {{pspan|composite}} to the CLI (in &amp;lt;color&amp;gt;, if specified and valid) and to the session logs.&amp;lt;br&amp;gt;&lt;br /&gt;
If {{pspan|composite}} isn&amp;#039;t a composite value (record or aggregate), functions similarly to print().|&lt;br /&gt;
&lt;br /&gt;
code1={{CodeSample|&lt;br /&gt;
title=Code Sample|&lt;br /&gt;
description=This example starts with [https://kolmafia.us/showthread.php?280-Records-in-ASH Veracity&amp;#039;s introductory example on records].|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
/* definition */&lt;br /&gt;
record my_type {&lt;br /&gt;
    int ifield;&lt;br /&gt;
    string sfield;&lt;br /&gt;
    record {&lt;br /&gt;
        int first;&lt;br /&gt;
        int second;&lt;br /&gt;
    } rfield;&lt;br /&gt;
    int [int, int] mfield;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
my_type rvar;&lt;br /&gt;
my_type [int] mrvar;&lt;br /&gt;
&lt;br /&gt;
/* population/assignments */&lt;br /&gt;
rvar.ifield = 10;&lt;br /&gt;
rvar.sfield = &amp;quot;secret&amp;quot;;&lt;br /&gt;
rvar.rfield.first = 1000;&lt;br /&gt;
rvar.rfield.second = 2000;&lt;br /&gt;
rvar.mfield[ 2, 3 ] = 12;&lt;br /&gt;
&lt;br /&gt;
mrvar[ 1 ] = rvar;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
code2={{CodeSample|&lt;br /&gt;
description=Then, instead of using &amp;#039;&amp;#039;foreach&amp;#039;&amp;#039; loops, simply does:|&lt;br /&gt;
code=&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
dump(mrvar);&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;|&lt;br /&gt;
moreinfo=which will print in the CLI:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
aggregate my_type [int]&lt;br /&gt;
1 =&amp;gt; record my_type&lt;br /&gt;
  ifield =&amp;gt; 10&lt;br /&gt;
  sfield =&amp;gt; secret&lt;br /&gt;
  rfield =&amp;gt; record (anonymous record 7dbf2293)&lt;br /&gt;
    first =&amp;gt; 1000&lt;br /&gt;
    second =&amp;gt; 2000&lt;br /&gt;
  mfield =&amp;gt; aggregate int [int, int]&lt;br /&gt;
    2 =&amp;gt; aggregate int [int]&lt;br /&gt;
      3 =&amp;gt; 12&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
}}|&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
cli_equiv=This is the equivalent of returning/ending with a variable with the CLI command &amp;quot;ash&amp;quot;, minus the color option.|&lt;br /&gt;
see_also={{SeeAlso|print|logprint}}|&lt;br /&gt;
special=[https://kolmafia.us/showthread.php?25398-print()&amp;amp;p=158966&amp;amp;viewfull=1#post158966 Take note that the behaviour of this function with non-composite values is NOT the exact same as print().]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Miscellaneous Functions]]&lt;/div&gt;</summary>
		<author><name>Fredg1</name></author>
	</entry>
</feed>