The "array_write" Function

Syntax#

array_write(id, [pretty]);
ArgumentTypeDescription
idarrayThe index of a previously-created array to encode as a string
[pretty]booleanOptional: Enables or disables formatting the string with linebreaks and indentation

Description#

Converts an array of any dimensions to a string, optionally with "pretty-print" to separate values by line with proper indenting.

Note that all array contents will be treated as strings. If the array contains pointers to other types of data, the pointer will be written literally rather than writing the contents of the data itself. The exception to this rule is sub-arrays and structs, which will be preserved.

Example#

var file = file_text_open_write("save.dat");
file_text_write_string(file, array_write(my_array, true));
file_text_close(file);