Skip to main content

The "array_write" Function


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


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.


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