Reply
Thread Tools Display Modes
Unread 02-18-12, 12:46 AM   #1
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
Having a problem with RDXDB.SetPackageMetadata

I created a table (??? think that's what it's called) named TRUESYS.MD, that will always have my metadata available.

I then have another function that runs to check if TRYESYS.MD[1] is greater than the current version of my package, and if so, empties the package then using RDXDB.SetPackageMetadata I reassign all of my metadata.

This doesn't seem to work for me, though. Do you see anything blatantly wrong, Sigg? I end up with no metadata at all after emptying the package, even after supposedly reassigning all of my metadata.

lua Code:
  1. TRUESYS.PKG = {
  2.     "true_core",
  3.     "true_unitframes",
  4.     "true_multiframes"
  5. };
  6.  
  7. TRUESYS.MD = {
  8.     "1.1",
  9.     "Unlimit",
  10.     "Demon Soul US",
  11.     "matt@wowrdx.com",
  12.     "manversuspixel.com",
  13.     "(True) Adaptive User Interface",
  14.     "infoIsShare",
  15.     "infoIsImmutable",
  16.     "infoIsIndelible"
  17. };
  18.  
  19. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  20.     if not RDXDB.GetPackage(TRUESYS.PKG[1]) then return nil; end
  21.     if not RDXDB.GetPackageMetadata(TRUESYS.PKG[1], "infoVersion") then return nil; end
  22.  
  23.     if RDXDB.GetPackageMetadata(TRUESYS.PKG[1], "infoVersion") < TRUESYS.MD[1] then
  24.         RDX.print("Updating (True) Adaptive User Interface to the latest version!");
  25.         for i=1,3 do
  26.             RDXDB._EmptyPackage(TRUESYS.PKG[i])
  27.             for g=1,9 do
  28.                 RDXDB.SetPackageMetadata(TRUESYS.PKG[i], TRUESYS.MD[g], true)
  29.             end
  30.         end
  31.     end
  32. end);
  33.  
  34. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  35.     -- Define a local to package name and set package metadata
  36.     local core = RDXDB.GetOrCreatePackage(TRUESYS.PKG[1]);
  37.     local unitframes = RDXDB.GetOrCreatePackage(TRUESYS.PKG[2]);
  38.     local multiframes = RDXDB.GetOrCreatePackage(TRUESYS.PKG[3]);
  39.     for i=1,3 do
  40.         for g=1,9 do
  41.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], TRUESYS.MD[g], true)
  42.         end
  43.     end
  44.  
  45. -- Do stuff
  46.  
  47. end);
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
unlimit is offline   Reply With Quote
Unread 02-18-12, 03:28 AM   #2
sigg
Featured Artist
 
sigg's Avatar
Featured
Join Date: Aug 2008
Posts: 1,204
It is because "1.1" is a string.

I suggest that you use version 1, version 2 etc ....

By default, elements in your table are string.

Use the function:
local numb = tonumber(RDXDB.GetPackageMetadata(TRUESYS.PKG[1], "infoVersion"))

Cheers
__________________
RDX manager
Sigg
sigg is offline   Reply With Quote
Unread 02-18-12, 02:33 PM   #3
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
Ah. No, the thing that was blatantly wrong was my use of RDXDB.SetPackageMetadata().

lua Code:
  1. TRUESYS.PKG = {
  2.     "true_core",
  3.     "true_unitframes",
  4.     "true_multiframes"
  5. };
  6.  
  7.     TRUESYS.MD = {
  8.     "1.1",                                              -- infoVersion
  9.     "Unlimit",                                          -- infoAuthor
  10.     "Demon Soul US",                                    -- infoRealm
  11.     "matt@wowrdx.com",                                  -- infoAuthorEmail
  12.     "manversuspixel.com",                               -- infoAuthorWebSite
  13.     "(True) Adaptive User Interface",                   -- infoComment
  14.     "infoIsShare",
  15.     "infoIsImmutable",
  16.     "infoIsIndelible"
  17. };
  18.  
  19. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  20.     local version = RDXDB.GetPackageMetadata(TRUESYS.PKG[1], "infoVersion")
  21.     local update
  22.  
  23.     if not RDXDB.GetPackage(TRUESYS.PKG[1]) then return nil; end
  24.     if not version or version < TRUESYS.MD[1] then update = true; end
  25.  
  26.     if update == true then
  27.         RDX.print("Updating (True) Adaptive User Interface to the latest version!");
  28.         for i=1,3 do
  29.             RDXDB._EmptyPackage(TRUESYS.PKG[i], true)
  30.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoVersion", TRUESYS.MD[1]);
  31.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthor", TRUESYS.MD[2]);
  32.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorRealm", TRUESYS.MD[3]);
  33.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorEmail", TRUESYS.MD[4]);
  34.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorWebSite", TRUESYS.MD[5]);
  35.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoComment", TRUESYS.MD[6]);
  36.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsShare", TRUESYS.MD[7]);
  37.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsImmutable", TRUESYS.MD[8]);
  38.             RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsIndelible", TRUESYS.MD[9]);
  39.         end
  40.     else
  41.         RDX.print("(True) Adaptive user Interface is up to date!");
  42.     end
  43. end);
  44.  
  45. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  46.     -- Define a local to package name and set package metadata
  47.     local core = RDXDB.GetOrCreatePackage(TRUESYS.PKG[1]);
  48.     local unitframes = RDXDB.GetOrCreatePackage(TRUESYS.PKG[2]);
  49.     local multiframes = RDXDB.GetOrCreatePackage(TRUESYS.PKG[3]);
  50.     for i=1,3 do
  51.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoVersion", TRUESYS.MD[1]);
  52.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthor", TRUESYS.MD[2]);
  53.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorRealm", TRUESYS.MD[3]);
  54.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorEmail", TRUESYS.MD[4]);
  55.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoAuthorWebSite", TRUESYS.MD[5]);
  56.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoComment", TRUESYS.MD[6]);
  57.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsShare", TRUESYS.MD[7]);
  58.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsImmutable", TRUESYS.MD[8]);
  59.         RDXDB.SetPackageMetadata(TRUESYS.PKG[i], "infoIsIndelible", TRUESYS.MD[9]);
  60.     end
  61.  
  62.     -- do stuff
  63.  
  64. end);
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **

Last edited by unlimit : 02-18-12 at 11:15 PM.
unlimit is offline   Reply With Quote
Reply

Go BackWoWInterface » Featured Projects » OpenRDX » OpenRDX Support » OpenRDX: Bug/Error Reports » Having a problem with RDXDB.SetPackageMetadata

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