Skip to main content

Category

A marker pack category.

Fields

FieldTypeDescription
DefaultTogglebooleanIf the category is enabled by default.
DisplayNamestringThe display name of the category displayed within the UI.
IsHiddenbooleanIf the category is hidden in the UI.
IsSeparatorbooleanIf the category is used as a separator within the UI.
LoadedFromPackbooleanIf the category was loaded from a pack.
NamestringThe name of the category (the name attribute).
NamespacestringThe namespace of the category (the type attribute used by other pathables).
ParentCategoryThe parent category of this category or nil if there is no parent category.
RootbooleanIf the category is the root category.

Functions

FunctionDescription
GetOrAddCategoryFromNamespaceReturns the requested category by namespace if one exists or creates one and returns it.
IsVisibleIndicates if the category is currently enabled by the user.
ShowEnables the category.
HideDisables the category.
GetMarkersReturns all markers directly within the category.


Category:GetOrAddCategoryFromNamespace(namespace)

Returns the requested category by namespace if one exists or creates one and returns it.

Parameters

ParameterTypeDescription
namespacestringThe namespace of the category to return.

Returns | Category

The existing or created category.

Usage

script.lua
local myCategory = Category:GetOrAddCategoryFromNamespace("my.category.namespace")

Debug:Print("The category is a separator: " .. tostring(myCategory.IsSeparator))


Category:IsVisible()

Indicates if the category is currently enabled by the user.

Returns | boolean

True if the user has enabled this category. Otherwise false.

Usage

script.lua
local myCategory = Category:GetOrAddCategoryFromNamespace("my.category.namespace")

if myCategory:IsVisible() then
Debug:Print("The category is visible.")
else
Debug:Print("The category is not visible.")
end


Category:Show()

Enables the category.

Usage

script.lua
local myCategory = Category:GetOrAddCategoryFromNamespace("my.category.namespace")

if not myCategory:IsVisible() then
myCategory:Show()
end


Category:Hide()

Disables the category.

Usage

script.lua
local myCategory = Category:GetOrAddCategoryFromNamespace("my.category.namespace")

if myCategory:IsVisible() then
myCategory:Hide()
end


Category:GetMarkers(getAll)

Returns all markers directly within the category.

Parameters

ParameterTypeDescription
getAllboolean
Optional
If true, all child markers are returned. If false or not provided, only the markers directly within the category are returned.

Returns | Marker[]

A table of markers.

Usage

script.lua
local myCategory = Category:GetOrAddCategoryFromNamespace("my.category.namespace")
local markers = myCategory:GetMarkers()

for _, marker in ipairs(markers) do
Debug:Print("Marker name: " .. marker.Name)
end