Skip to content

A library that generates addon settings from a template.

License

Notifications You must be signed in to change notification settings

Eyal-WowHub/AddonConfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AddonConfig

A library that generates addon settings from a template.

Dependencies: LibStub, Contracts

Examples:

local Config = LibStub("AddonConfig-1.0")

Traditional Template

The following example demonstrates the traditional template structure for creating the settings:

local settings = {
    name = "AddonName",
    type = "vertical-layout",
    props = {
        {
            name = "Category 1",
            type = "vertical-layout",
            props = {
                {
                    name = "Click Me!",
                    type = "button",
                    click = ClickHandler
                }
            }
        },
        {
            name = "Category 2",
            type = "vertical-layout",
            props = {}
        },
        {
            name = "Category 3",
            type = "vertical-layout",
            props = {}
        }
    }
}

local optionsID = Config:Generate(settings)

Simplified Template

For a more concise approach, you can use the following simplified template style, which produces the same results as the above:

local settings = {
    {
        name = "AddonName"
    },
    {
        name = "Category 1",
        layout = {
            {
                name = "Click Me!",
                type = "button",
                click = ClickHandler
            }
        }
    },
    {
        name = "Category 2",
        layout = {}
    },
    {
        name = "Category 3",
        layout = {}
    }
}

local optionsID = Config:Generate(settings, "vertical-style")

Releases

No releases published

Packages

No packages published

Languages