Skip to content

Api > Text > TryGetComponent()


Text.TryGetComponent([]{Generic : Component|info} type)⚓︎

Gets the component of the specified type, if it exists.

Parameters:⚓︎

Name Type Description
type []{Generic : Component info}

Returns:⚓︎

type Description
boolean Returns true if the component is found, false otherwise.
[]{Generic : Component info}

Usage⚓︎

---@type Text
local text;

---@type TComponent
local type;


local val0, val1 = text.TryGetComponent(type)

Example⚓︎

exists, component = myComponent.TryGetComponent(Transform);
-- exists is a boolean
-- component is Component or nil