From Kolmafia
Jump to navigation Jump to search

Function Syntax

void dump(any composite )

void dump(any composite ,string color )

  • composite is the variable to dump. Can be any data type (besides void), but the intended use is with an aggregate or a record.
  • color is an html color name or code. See print for more information.

"Dumps" (i.e. "unfolds", showing every key/field of the variable, and their value) composite to the CLI (in <color>, if specified and valid) and to the session logs.
If composite isn't a composite value (record or aggregate), functions similarly to print().

Code Sample

This example starts with Veracity's introductory example on records.

/* definition */
record my_type {
    int ifield;
    string sfield;
    record {
        int first;
        int second;
    } rfield;
    int [int, int] mfield;

my_type rvar;
my_type [int] mrvar;

/* population/assignments */
rvar.ifield = 10;
rvar.sfield = "secret";
rvar.rfield.first = 1000;
rvar.rfield.second = 2000;
rvar.mfield[ 2, 3 ] = 12;

mrvar[ 1 ] = rvar;

Then, instead of using foreach loops, simply does:


which will print in the CLI:

aggregate my_type [int]
1 => record my_type
  ifield => 10
  sfield => secret
  rfield => record (anonymous record 7dbf2293)
    first => 1000
    second => 2000
  mfield => aggregate int [int, int]
    2 => aggregate int [int]
      3 => 12

CLI Equivalent

This is the equivalent of returning/ending with a variable with the CLI command "ash", minus the color option.

See Also

print() | logprint()


Take note that the behaviour of this function with non-composite values is NOT the exact same as print().