Category
A marker pack category.
Fields
Field | Type | Description |
---|---|---|
DefaultToggle | boolean | If the category is enabled by default. |
DisplayName | string | The display name of the category displayed within the UI. |
IsHidden | boolean | If the category is hidden in the UI. |
IsSeparator | boolean | If the category is used as a separator within the UI. |
LoadedFromPack | boolean | If the category was loaded from a pack. |
Name | string | The name of the category (the name attribute). |
Namespace | string | The namespace of the category (the type attribute used by other pathables). |
Parent | Category | The parent category of this category or nil if there is no parent category. |
Root | boolean | If the category is the root category. |
Functions
Function | Description |
---|---|
GetOrAddCategoryFromNamespace | Returns the requested category by namespace if one exists or creates one and returns it. |
IsVisible | Indicates if the category is currently enabled by the user. |
Show | Enables the category. |
Hide | Disables the category. |
GetMarkers | Returns 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
Parameter | Type | Description |
---|---|---|
namespace | string | The 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
Parameter | Type | Description |
---|---|---|
getAll | boolean | 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