Thread Tools Display Modes
Prev Previous Post   Next Post Next
12/09/19, 10:34 PM   #1
MethosFrost
AddOn Author - Click to view addons
Join Date: Dec 2018
Posts: 5
Dynamic Menu with LibAddonMenu

Still learning so I hope the answer isn't obvious. I'm testing creating a dynamic menu using LibAddonMenu and I can get the menu to show up with no errors but I'm having an issue when it comes to the get/set. I'm unable to get them to properly read or assign the settings. I'm 90% sure that the issue is getting the "functionGet/functionSet" functions to be uniform and not have part of it be a string just not sure how to accomplish.


The functions I'm using to create the menu are:
Lua Code:
  1. local function CheckboxMenuAdd(settingName)
  2.     local set = settingName
  3.     local setting = AllCraft_Decon.deconSettings
  4. --Find a way to get this to populate properly, Answer is always nil
  5.     local functionGet =  function() return setting.set end
  6.     local functionSet = function(value) setting.set = value end
  7.  
  8.     local x = {}
  9.         x.type = "checkbox"
  10.         x.name = tostring(settingName)
  11.         x.getFunc = functionGet
  12.         x.setFunc = functionSet
  13.     return x
  14. end
  15.  
  16. function ACLoadMenu()
  17.     local t = getmetatable(AllCraft_Decon.deconSettings).__index
  18.     local setting = AllCraft_Decon.deconSettings
  19.     local menu = {type = "submenu",
  20.     name = "Table Options",
  21.     controls = {}}
  22.  
  23.     for key, value in pairs(t) do
  24.         if key ~= "version" then
  25.             if string.find( key,"Deconstruct_Set_Type_") then
  26.                 table.insert (menu.controls, CheckboxMenuAdd(key))
  27.             end
  28.         end
  29.     end
  30.     return menu
  31. end

FullCode@ https://github.com/MethosFrost/AllCraft
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » Dynamic Menu with LibAddonMenu

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off