Function: ElementHasAncestor
Function: ElementHasAncestor

Function: ElementHasAncestor

ElementHasAncestor ( ELEMENT, PARENT )

This function checks if an element has another element as an ancestor.

Parameters

Parameter Type Description
ELEMENT ELEMENT Any element (archetype or non-archetype).
PARENT ELEMENT Any element to check the possible parentage of (archetype or non-archetype).

Returns

VALUE(BOOLEAN) TRUE if the first element is an ancestor of the second element, or FALSE otherwise.

What It Does

This function tests if an element has the other provided element as an ancestor (the first element is a descendant). This returns TRUE if the first element is an ancestor of the second element, or FALSE otherwise.

Example

Element Has Ancestor Example


object archetype o_keys;
object o_bronzekey : o_keys;
object o_woodenkey : o_keys;
object o_door;

world
{
	start()
	{
		textln("o_bronzekey is an ancestor of o_keys: " + elementHasAncestor(o_bronzekey, o_keys));
		textln("o_woodenkey is an ancestor of o_keys: " + elementHasAncestor(o_woodenkey, o_keys));
		textln("o_keys is an ancestor of o_woodenkey: " + elementHasAncestor(o_keys, o_woodenkey));
		textln("o_door is an ancestor of o_keys: " + elementHasAncestor(o_door, o_keys));
		quit;
	}
}
×

Modal Header