How would you store this JSON style data in GM?

Schwee

Member
Still new to this approach to thinking and it gives me a headache.

Code:
pages = [
    0: {
        paragraphs: [1, 2, 3],
        options: [2, 4, 6, 7]
    },
    1: {
        paragraphs: [18, 12],
        options: [3]
    },
    2: {
        ...
    },
    ...
]
Note that the # of items in the paragraphs and options arrays can and will vary. As far as I know...you can't store arrays within any data structures. Trying to think of a setup that will minimize data structures storing references to other data structures to keep my sanity. Thanks!
 

FrostyCat

Redemption Seeker
Don't you know you can store lists inside maps with ds_map_add_list()? You wouldn't need to keep track of that list ID later, just remove the top-level map and the children would be cleaned up along the way. Learn to use JSON nesting functions at the bottom of this Manual page.
 
Top