For everyone's sanity, data structures in NTT are wrapped in small structs
so that it is easier to tell what is what and so that mod's data structures
can be unloaded when the mod is unloaded.
Each DS type gains a new _valid
function that returns if the given value is a data structure
of that kind.
Lists
The following are more or less unchanged:
The following are extra:
Adds contents of an array to the end of a list.
Removes a single value from a list, returns whether it was found-removed.
Joins the contents of a list to a string with separator
string added between them.
Creates a new array and copies the contents of the list to it.
Maps
Nothing new over here.
Deprecated, use ds_map_keys_to_array
.
Deprecated, use ds_map_values_to_array
.
Grids
The following are unchanged:
The following are extra:
Joins the contents of a grid to a string with row/column separators.
Good for quickly displaying grids, but not necessarily a valid CSV/TSV.
JSON
This works closer to json_parse
as it returns structs and arrays, not data structures.
If JSON fails to parse, it returns json_error
(special value)
and stores the error text in json_error_text.
This stores the error message for the last failed json_decode.
This works closer to json_stringify
as it works with structs and arrays, not data structures.
Also note that it accepts an indentation string
(or undefined
/ no argument to not pretty-print)
instead of a boolean flag like the built-in function does.
And these two used to be special values back when GM didn't have an easy way to check
whether something is a boolean, but now they're just aliases for true
/false
Currently not implemented due to being easy to replace with lists/arrays.