View Single Post
06/07/14, 07:25 PM   #15
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
1. I was thinking just have it as an optional field. If present, you could show the title for the panel as
"ADDON NAME by Author".

3. First, code of what was thinking for the API function
Lua Code:
  1. function lam:AddOptionControl(addonID, optionParams)
  2.     if addonToOptionsMap[addonID] == nil then
  3.         addonToOptionsMap[addonID] = {}
  4.     end
  5.     table.insert(addonToOptionsMap, optionParams)
  6. end

Two reasons - 1) update based on a settings change. 2) Allow authors to construct settings table in a manner that is (a bit) closer to how it currently works:
Lua Code:
  1. lam:AddOptionControl("Foo", {
  2.     type = "header",
  3.     name = "My Header",
  4. })
  5. lam:AddOptionControl("Foo", {
  6.     type = "dropdown",
  7.     name = "My Dropdown",
  8.     tooltip = "Dropdown's tooltip text.",
  9.     choices = {"table", "of", "choices"},
  10.     getFunc = function() return "of" end,
  11.     setFunc = function(var) print(var) end,
  12. })

The second point was if you need it to have consecutive indexes (like in your example), you might want to only do this method to guarantee you have that. What happens if you're fed in somthing like the following?
Lua Code:
  1. { "header" = { ... }, "some" = {...}, "other" = {...}, "controls" = {...} }

4. A NIL value is being passed in as the title. Screenshot attached.

----------

Yeah, I did an adapter since that's a quick way to test a lot of the functionality with how people are actually using it in addons. I wasn't intending for it to be included, as a lot of addons touch the options panel or the LAM variables directly, making it impossible for them to work through an adapter.
Attached Thumbnails
Click image for larger version

Name:	lam2-ss.jpg
Views:	990
Size:	182.4 KB
ID:	283