Asset - Scripts ds_tree - Tree Data Structures for GM:S

D

Dark

Guest
https://marketplace.yoyogames.com/assets/4011/ds_tree

This asset provides scripts for tree data structures implemented in native GML. The scripts contain autocomplete and argument information as well as a short description of what each does.

Example usage:
Code:
root = ds_tree_create(10);
root_a = ds_tree_add(root, "A", 25.24);
root_b = ds_tree_add(root, "B", "foo");
ds_tree_add(root_b, "bar", -2);
show_debug_message(ds_tree_get_value(root));
show_debug_message(ds_tree_get_value(root_a));
show_debug_message(ds_tree_get_value(root_b));
show_debug_message(ds_tree_get_value(ds_tree_get_child(root_b, "bar")));
 
D

Dark

Guest
The difference is that it's the same thing provided in ready made scripts so that you don't have to make them yourself. Sure, some people prefer to reinvent the wheel but I don't always like to for small things like this and I assumed there's others who don't either.
 

zbox

Member
GMC Elder
Once again - absolutely no offence intended I'm just curious, but it would, in this scenario, be you who was reinventing the wheel and writing extra scripts.

GM supports embedded data natively, without scripts :p
 
D

Dark

Guest
I guess I'm misunderstanding what you mean by "embedded data". I thought you meant something such as a map inside a map. Is this a GMS 2 thing?
 

zbox

Member
GMC Elder
Embedded data/maps in GMS1 and 2 yeah, like how you can do this:
Code:
root = json_decode("{'root1':{'a':1,'b':2}, "root2":{'one':'asdf','two':'1234'}}")

root1 = root[? "root1"]
root1_a = root1[? "a"];
Which is what it looks like yours is doing right?
 
Top