View Single Post
02/06/15, 03:42 AM   #34
Randactyl
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 251
Ahh. Well, it's already possible to use custom controls. Why not use a similar system for library options?

First, we'd need to identify what LAM's settable options would be. Then, do something in LibAddonMenu-2.0.lua like:

Lua Code:
  1. lam.options = lam.options or {
  2.     isBorderVisible = false,
  3.     useStylizedLeftPanelBackground = true,
  4.     option3 = val,
  5.     option4 = otherVal,
  6. }
  7.  
  8. function lam:RegisterOption(key, value)
  9.     if lam.options[key] then lam.options[key] = value end
  10. end

The values in the options table could then be used instead of hard-coded values. I imagine some kind of refresh or reinitialization would need to be performed too.

Then you could distribute options addons dependent on LAM-2.0 rather than redistributing the whole library in different forms (and then having to maintain all of them when things need fixing).

LAM-2.0_classic.lua
Lua Code:
  1. local LAM = LibStub("LibAddonMenu-2.0")
  2.  
  3. LAM:RegisterOption("isBorderVisible", true)
  4. LAM:RegisterOption("useStylizedLeftPanelBackground", false)

It's late and I kinda feel like I'm rambling I'll come back after some sleep.

edit: this was in response to votan. sirisidiator snuck in while I was typing haha.

Last edited by Randactyl : 02/06/15 at 03:48 AM.
  Reply With Quote