Container:remove_child

Removes a child element.

This function will error if the child passed in is not a child of this container.

Usage

container:remove_child(child)

Arguments

Name Type Description
child UIElement Child element to remove.

Examples

local list = crystal.VerticalList:new();
local sword = self.list:add_child(crystal.Image:new(crystal.assets.get("assets/sword.png")));
local shield = self.list:add_child(crystal.Image:new(crystal.assets.get("assets/shield.png")));
local armor = self.list:add_child(crystal.Image:new(crystal.assets.get("assets/armor.png")));

list:remove_child(shield);
assert(shield:parent() == nil);

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