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:
local function CheckboxMenuAdd(settingName)
local set = settingName
local setting = AllCraft_Decon.deconSettings
--Find a way to get this to populate properly, Answer is always nil
local functionGet = function() return setting.set end
local functionSet = function(value) setting.set = value end
local x = {}
x.type = "checkbox"
x.name = tostring(settingName)
x.getFunc = functionGet
x.setFunc = functionSet
return x
end
function ACLoadMenu()
local t = getmetatable(AllCraft_Decon.deconSettings).__index
local setting = AllCraft_Decon.deconSettings
local menu = {type = "submenu",
name = "Table Options",
controls = {}}
for key, value in pairs(t) do
if key ~= "version" then
if string.find( key,"Deconstruct_Set_Type_") then
table.insert (menu.controls, CheckboxMenuAdd(key))
end
end
end
return menu
end
FullCode@
https://github.com/MethosFrost/AllCraft