View Single Post
09-07-21, 12:19 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,878
You could just change
Code:
CRE_GuildRoster = {
    {
to
Code:
CRE_GuildRoster = {
    ["Players"] = {
in the SavedVariables file (your addon will need to be ready for the change next login):

or for a an already distributed addon:
Lua Code:
  1. local function CopyTable(src, dest)
  2.     for index, value in pairs(src) do
  3.         if (type(value) == "table") then
  4.             dest[index] = {};
  5.             DL_Copy_Table(value, dest[index]);
  6.         else
  7.             dest[index] = value;
  8.         end
  9.     end
  10. end
  11.    
  12. CRE_GuildRoster.Players = {}
  13. CopyTable(CRE_GuildRoster[1], CRE_GuildRoster.Players)
  14. tremove(CRE_GuildRoster, 1)
That should copy all the entries from [1] to ["Players"] even if you have more entries than just ["Noxis"].

It doesn't account for having tables other than [1] with information to be transfered.

While testing, you could do the tremove(CRE_GuildRoster, 1) seperately after you've logged out and verified the information has been copied (make backups of your Saved Variables file first)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 09-07-21 at 12:35 AM.
  Reply With Quote