Advertisement
Guest User

Untitled

a guest
Mar 7th, 2019
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.80 KB | None | 0 0
  1. local db
  2. local defaults = {
  3.     profile = {
  4.     },
  5.     global = {
  6.         hasUpdate = false,
  7.         hasChildren = false,
  8.         hasName = false,
  9.         isVisible = false
  10.     }
  11. }
  12.  
  13. local alphabet = {
  14.     "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
  15. }
  16.  
  17. local options = {
  18.     name = "FrameFiesta",
  19.     type = "group",
  20.     handler = FF,
  21.     childGroups = "tab",
  22.     args = {
  23.         framesTab = {
  24.             order = 2,
  25.             type = "group",
  26.             name = "frames",
  27.             childGroups = "tab",
  28.             args = {
  29.                 toggleVisible = {
  30.                     type = "execute",
  31.                     order = 1,
  32.                     name = "Refresh",
  33.                     desc = "",
  34.                     func = "addArgs",
  35.                 },
  36.                 frames = {
  37.                     order = 2,
  38.                     type = "group",
  39.                     name = "Frames",
  40.                     childGroups = "tab",
  41.                     args = dbStructContainer
  42.                 }
  43.             }
  44.         },
  45.     }
  46. }
  47.  
  48. local function iterate(frame, shown, letter)
  49.     local args = { }
  50.     local step = 0
  51.     for k, v in pairs(frame) do
  52.         if string.sub(v, 1, 1) == letter then
  53.             step = step + 1
  54.             settings = {
  55.                 order = step,
  56.                 type = "toggle",
  57.                 enabled = shown[k],
  58.                 name = tostring(v),
  59.                 set = function(info, value)
  60.                     shown[k] = _G[v]:IsShown()
  61.                     if shown[k] then
  62.                         _G[v]:Hide()
  63.                     else
  64.                         _G[v]:Show()
  65.                     end
  66.                     shown[k] = _G[v]:IsShown()
  67.                     end,
  68.                 get = function(info) return shown[k] end
  69.             },
  70.         insert(args, step-1, settings)
  71.         end
  72.     end
  73.     return args
  74. end
  75.  
  76. function FF:addArgs()
  77.     emptyTable(dbStructContainer)  
  78.     emptyTable(dbStruct)
  79.  
  80.     local steps = 0
  81.     for k, v in pairs(alphabet) do
  82.         steps = steps + 1
  83.         dbStruct = {
  84.             order = steps,
  85.             type = "group",
  86.             name = tostring(v),
  87.             childGroups = "tab",
  88.             args = iterate(loneFrame, loneFrameShown, v),
  89.         }
  90.         insert(dbStructContainer, steps, dbStruct)
  91.     end
  92.    
  93.     FF.db.global.args = dbStructContainer
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement