1function show_parents(me)
2	print("showing parents of", image_tracetag(me));
3	local parent = image_parent(me);
4
5	while valid_vid(parent) do
6		print("parent", parent, me, image_tracetag(parent));
7		parent = image_parent(parent);
8	end
9end
10
11function show_children(me)
12	print("showing descendants to ", me);
13	local desc = function(node, fun)
14		local lst = image_children(node)
15		if (lst == nil) then
16			return;
17		end
18
19		for k,v in ipairs(lst) do
20			print(image_tracetag(v));
21			fun(v, fun);
22		end
23	end
24
25	desc(me, desc);
26end
27
28function set4_5()
29	local rbox = color_surface(200, 200, 255, 0, 0);
30	local bbox = color_surface(200, 200, 0, 0, 255);
31	local gbox = color_surface(200, 200, 0, 255, 0);
32
33	link_image(rbox, bbox);
34	link_image(bbox, gbox);
35
36	image_tracetag(rbox, "red");
37	image_tracetag(bbox, "blue");
38	image_tracetag(gbox, "green");
39
40	show_parents(rbox);
41	show_children(gbox);
42end
43