J
JapanGamer29
Guest
Hello. Sad to say that I haven't been destroying my data structures, and now that I'm going back through my code to do so, I'm getting all kinds of "index does not exist" errors.
I just need to clear up the confusion in my head about how to do this properly.
From the manual, I understand that you should 1) check the DS exists, 2) destroy it, and 3) set the variable that held it to -1.
But in my case, I'm passing these data structures from script to script. Let me try to make a simple example here:
To me, it looks like I now have 8 data structures in that example (2 lists, each containing 3 maps). OR is one list just pointing to the other? This is where I get confused. And I can't go about destroying them until I understand this. Thank you for any advice.
I just need to clear up the confusion in my head about how to do this properly.
From the manual, I understand that you should 1) check the DS exists, 2) destroy it, and 3) set the variable that held it to -1.
But in my case, I'm passing these data structures from script to script. Let me try to make a simple example here:
GML:
// script 1
var list_of_maps_2 = scr_script2();
// script 2
var list_of_maps_1 = ds_list_create();
for (i = 0; i < 3, i++)
{
var map = ds_map_create();
// put stuff in map
ds_list_add(list_of_maps_1, map);
}
return list_of_maps_1;