UIElement:is_within

Returns whether this element is a descendant of another one.

Usage

ui_element:is_within(other)

Arguments

Name Type Description
other UIElement Element which may or may not be an ancestor of this one.

Returns

Name Type Description
within boolean True if other is an ancestor of this element, false otherwise.

Examples

local pause_menu = crystal.Overlay:new();
local hud = crystal.Overlay:new();
local health_bar = hud:add_child(crystal.Overlay:new());
local health_bar_background = health_bar:add_child(crystal.Image:new());

print(health_bar_background:is_within(hud)); -- Prints "true"
print(health_bar_background:is_within(menu)); -- Prints "false"

This site uses Just the Docs, a documentation theme for Jekyll.