P
Paradox
Guest
Does deleting a data structure full of data structures delete all the data structures with in it?
//creating a dslist which holds other ds list
dslist = ds_list_create();
for(var i = 0;i<10;i++)
{
node = ds_list_create();
ds_list_add(node,i);
ds_list_add(dslist,node);
}
//deleting the dslists in the ds list
for(var i = 0;i<ds_list_size(dslist);i++)
{
ds_list_destroy(dslist[| i]);
}
ds_list_destroy(dslist);
This is a way to do it, looks correct to me. The alternative as suggested by GMWolf is to mark the internal data structures as such (using ds_list_mark_as_list in this case) and delete only the outer one.is this the correct way to delete a ds_list which contains ds_list in it?
ok this is has the same result as the previous code but I used ds_list_mark_as_list which makes it looks a bit smoother.This is a way to do it, looks correct to me. The alternative as suggested by GMWolf is to mark the internal data structures as such (using ds_list_mark_as_list in this case) and delete only the outer one.
//creating a dslist which holds other ds list
dslist = ds_list_create();
for(var i = 0;i<10;i++)
{
node = ds_list_create();
ds_list_add(node,i);
ds_list_add(dslist,node);
ds_list_mark_as_list(dslist,i)
}
ds_list_destroy(dslist);
No, you're just assigning numbers to the variables.I was wondering the same for the following example;
do data and map2 variables own their own map?Code:var a = json_decode(myJsonString); var data = a[? "data"]; var map2 = data[? "map"]; ds_list_destroy(a);