https://github.com/eyal-wowhub/addonconfig
A library that generates addon settings from a template.
https://github.com/eyal-wowhub/addonconfig
lib library lua world-of-warcraft world-of-warcraft-addon wow wow-addon
Last synced: about 1 year ago
JSON representation
A library that generates addon settings from a template.
- Host: GitHub
- URL: https://github.com/eyal-wowhub/addonconfig
- Owner: Eyal-WowHub
- License: bsd-3-clause
- Created: 2025-01-02T16:02:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-09T04:35:35.000Z (over 1 year ago)
- Last Synced: 2025-02-09T05:25:36.144Z (over 1 year ago)
- Topics: lib, library, lua, world-of-warcraft, world-of-warcraft-addon, wow, wow-addon
- Language: Lua
- Homepage:
- Size: 59.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AddonConfig
A library that generates addon settings from a template.
#### Dependencies: [LibStub](https://www.curseforge.com/wow/addons/libstub), [Contracts](https://github.com/Eyal-WowHub/Contracts)
### Examples:
```lua
local Config = LibStub("AddonConfig-1.0")
```
#### Traditional Template
The following example demonstrates the traditional template structure for creating the settings:
```lua
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:
```lua
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")
```