Pfap
Member
From my quick overview of the manual it seems to state that ds_lists and ds_maps should only be combined when working with json. Is the manual only talking about data that would need to be saved?
I did some tests and what I have works, but is it a bad idea to use it like the below?
Create event:
Tap event of test object:
I'm not going to need to save any of the values and I don't want to use an array because I'm not sure how many positions may end up getting used.
To restate my question: is using ds_maps and ds_lists like above a good practice?
I did some tests and what I have works, but is it a bad idea to use it like the below?
Create event:
Code:
my_map = ds_map_create();
my_list = ds_list_create();
ds_list_add(my_list,1,2,3,4,5,6,7,8,9,10,11,12);
ds_map_add(my_map,1,my_list);
ds_map_add(my_map,2,my_list);
ds_map_add(my_map,3,my_list);
ds_map_add(my_map,4,my_list);
ds_map_add(my_map,5,my_list);
Tap event of test object:
Code:
var r1,r2,r3,r4,r5;
r1 = ds_map_find_value(my_map,1);
r2 = ds_map_find_value(my_map,2);
r3 = ds_map_find_value(my_map,3);
r4 = ds_map_find_value(my_map,4);
r5 = ds_map_find_value(my_map,5);
var l1,l2,l3,l4,l5;
var i = 0;
repeat(12){
show_debug_message(ds_list_find_value(r1,i));
show_debug_message(ds_list_find_value(r2,i));
show_debug_message(ds_list_find_value(r3,i));
show_debug_message(ds_list_find_value(r4,i));
show_debug_message(ds_list_find_value(r5,i));
i += 1;
}
I'm not going to need to save any of the values and I don't want to use an array because I'm not sure how many positions may end up getting used.
To restate my question: is using ds_maps and ds_lists like above a good practice?