Thread Tools Display Modes
02-03-12, 05:42 PM   #1
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
A way to emulate the "Builtin" package?

I don't particularly want to create my package with an OOBE file, I'd rather do it the same way the 'Built In' package works. Is there a way to emulate it?

I tried using:

lua Code:
  1. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  2.  
  3.     local test = RDXDB.GetOrCreatePackage("test");
  4.  
  5.     if not test["test_script"] then
  6.         test["test_script"] = {
  7.             ["ty"] = "Script",
  8.             ["version"] = 1,
  9.             ["data"] = {
  10.                 ["script"] = "just random text",
  11.             },
  12.         }end
  13. end);

But that didn't seem to be cutting it.
__________________


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

Last edited by unlimit : 02-03-12 at 05:49 PM.
  Reply With Quote
02-03-12, 09:45 PM   #2
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
My mistake, My TOC was the problem.

However, I still do have one question. Is there anyway, using this method, that I can create a package without having to add in every little detail, object by object? like...

lua Code:
  1. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  2.     local test = RDXDB.GetOrCreatePackage("test");
  3.  
  4.     if not test then
  5.         test = {
  6.             -- Every object in package goes here!      
  7.         };
  8.     end
  9.    
  10. end);
__________________


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

Last edited by unlimit : 02-03-12 at 10:45 PM.
  Reply With Quote
02-04-12, 06:53 AM   #3
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
lua Code:
  1. local function InstallData(data)
  2.     if type(data) ~= "table" then return; end
  3.     -- Integrate
  4.     for pkgName, pkgData in pairs(data) do
  5.         for objName, objData in pairs(pkgData) do
  6.             RDXDB.GetOrCreatePackage(pkgName);
  7.             if type(objData) == "table" then
  8.                 local lf = RDXDB.TouchObject(pkgName .. ":" .. objName);
  9.                 if lf then
  10.                     lf.ty = objData.ty;
  11.                     lf.version = objData.version;
  12.                     lf.data = objData.data;
  13.                 end
  14.             else
  15.                 RDXDB.SetPackageMetadata(pkgName, objName, objData);
  16.             end
  17.         end
  18.     end
  19. end
  20.  
  21. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, InstallData([[
  22.     ["test_package"] = {
  23.         ["test_object"] = {
  24.             ["ty"] = "Window",
  25.             ["version"] = 1,
  26.             ["data"] = {
  27.                 {
  28.                     ["feature"] = "Frame: None",
  29.                     ["bkd"] = {
  30.                         ["_border"] = "none",
  31.                         ["_backdrop"] = "none",
  32.                     },
  33.                 }, -- [1]
  34.             },
  35.         },
  36.     },
  37. ]]);
  38. end);

Something like this, perhaps?
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote
02-06-12, 02:01 AM   #4
sigg
Featured Artist
 
sigg's Avatar
Featured
Join Date: Aug 2008
Posts: 1,251
Hi unlimit,

See the file RDX.Builtin.lua for some examples.

Cheers
Sigg
__________________
RDX manager
Sigg
  Reply With Quote
02-13-12, 06:19 PM   #5
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
I mean, I've already been doing that. <_< I was just curious if there was an EASIER way than doing it line by line.

To put it another way, the builtin.lua system makes it's package, then builds it's contents object by object.

Is there a way - besides the OOBE method - to simply create a package and it's objects all at once?
__________________


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

Last edited by unlimit : 02-15-12 at 01:07 AM.
  Reply With Quote
02-15-12, 01:09 AM   #6
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
bumpidy xD
__________________


kúdan: im playing pantheon
JRCapablanca: no youre not
** Pantheon has been Banned. **
  Reply With Quote
02-15-12, 09:33 AM   #7
sigg
Featured Artist
 
sigg's Avatar
Featured
Join Date: Aug 2008
Posts: 1,251
Try with the command
toto = VFL.copy({})
Instead of using
toto = {}
__________________
RDX manager
Sigg
  Reply With Quote
02-15-12, 03:16 PM   #8
unlimit
Lookin' Good
 
unlimit's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 484
Something like this, by chance?

lua Code:
  1. RDXEvents:Bind("INIT_DATABASE_LOADED", nil, function()
  2.     local test = RDXDB.GetOrCreatePackage("test_package");
  3.     if test then
  4.     test = {
  5.         ["test_object"] = {
  6.             ["ty"] = "Window",
  7.             ["version"] = 1,
  8.             ["data"] = {
  9.                 {
  10.                     ["feature"] = "Frame: None",
  11.                     ["bkd"] = {
  12.                         ["_border"] = "none",
  13.                         ["_backdrop"] = "none",
  14.                     },
  15.                 }, -- [1]
  16.             },
  17.         },
  18.     };
  19.     VFL.copy(test);
  20.     end
  21.    
  22. end);
__________________


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

WoWInterface » Featured Projects » OpenRDX » OpenRDX Community » OpenRDX: Community Chat » A way to emulate the "Builtin" package?


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