LoadArray()

Summary

Loads an array from a file.

Changes

In Version 2017 added loading from a native JSON text file.

Syntax

my_array = LoadArray(string file_name)

Argument Contents
file_name The file name, including full or partial path, of the file in which the array is saved

Returns

The array stored in the file.

Notes

  • The array can contain nested sub-arrays.

  • For more information on full and partial paths, see Identifying Files and Folders.

  • Use ReadArray() to read an array saved as strings in a text file by WriteArray().

  • If you load a GISDK option array from a text file with extension ".js" or ".json" then it expects that the text is in proper JSON (JavaScript Object Notation) literal format.

  • The input GISDK array must be a proper options array with string keys.

  • You can also convert between option arrays and JSON text files with ArrayToJson() and JsonToArray().

Error Codes

Error Type Meaning
Error The file does not contain an array or the array cannot be read
NotFound The file cannot be opened

See Also

Function Summary
ArrayToJson() Converts an options array to a proper JSON literal object
JsonToArray() Converts a proper JSON literal object to an options array
ReadArray() Reads a text file into an array of strings
SaveArray() Saves an array to a file