U
Uulamock
Guest
So here is the setting: Let's say I have a giant object parent tree, to keep it simple I'll have it be linear. So for example:
obj_parent1
obj_parent2 //child of obj_parent1
obj_parent3 //child of obj_parent2
/* skip a few */
obj_parent50 //child of obj_parent49
I have these 50 objects, and they are all part of an inheritance tree (a line in this case). Now, what I want to do is check if an object is a child of any previous parent. So ex:obj_parent2 //child of obj_parent1
obj_parent3 //child of obj_parent2
/* skip a few */
obj_parent50 //child of obj_parent49
var child = obj_parent50;
var parent = obj_parent1;
if (child == parent) { /* do stuff */ }
In this example, child does not equal parent, because child is obj_parent50 while parent is obj_parent1. How can I always get a positive comparison if an object is a great, great, great...great grandchild?var parent = obj_parent1;
if (child == parent) { /* do stuff */ }