View Single Post
09-06-21, 11:52 PM   #1
NoxisAT
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jun 2021
Posts: 3
SavedVariables formatting

Hi,

this is my my Saved Variables now:
Lua Code:
  1. CRE_GuildRoster = {
  2.     {
  3.         ["Noxis"] = {
  4.             ["Class"] = "Priest",
  5.             ["Note"] = "Main",
  6.             ["Gilde"] = "Sometimes Prepared",
  7.             ["Level"] = 70,
  8.         },
  9.     }, -- [1]
  10. }

i want it to look like this i added the ["Players"] node

Lua Code:
  1. CRE_GuildRoster = {
  2.     ["Players"] ={
  3.         ["Noxis"] = {
  4.             ["Class"] = "Priest",
  5.             ["Note"] = "Main",
  6.             ["Gilde"] = "Sometimes Prepared",
  7.             ["Level"] = 70,
  8.         },
  9.     },
  10. }

this is my function:
Lua Code:
  1. local t = {}
  2. function CreateGRTable()
  3.    
  4.     wipe(t)
  5.     numTotal = GetNumGuildMembers();
  6.     for i = 1, numTotal do
  7.         name, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName, achievementPoints, achievementRank, isMobile, isSoREligible, standingID = GetGuildRosterInfo(i)
  8.         tinsert(t, i, {[Split(name, "-")[1]] = {Level = level, Gilde = guildName, Class = class, Note = officernote}})
  9.     end
  10.     CRE_GuildRoster[Players] = t
  11. end

can anyone explain me how to do this?
thanks
  Reply With Quote