AceDB-3 don't make tables work, it provides a set of tables in a predefined order that the vast majority of addons like and use. However, all it really does is provide a nice set of overlay tables for a SavedVariable.
I understand this. when i attempted to do this, i received some errors. My assumption was that there was some limitations with AceDB. I must have missed something else.
I have not coded in almost 15 years so I am finding myself having to relearn some things. I apologize if it seems i am asking stupid questions.
char.var1
char.var2
I need something like this:
global.container1.var1
global.container1.subcontainer1.varx
global.container2.var2
Is this possible using AceDB3
CiscOH
thanks
eh a table is a table.. what you describe you can do..
AceDB-3 don't make tables work, it provides a set of tables in a predefined order that the vast majority of addons like and use. However, all it really does is provide a nice set of overlay tables for a SavedVariable.
local t = {}
t.subtable = {}
t.subtable.var = "something"
is the same as:
db.global.container1 = {}
db.global.container1.var1 = "key1"
If you don't understand one or either of these then read up at:
http://lua-users.org/wiki/TutorialDirectory
http://www.lua.org/pil/
This isn't an Ace issue, it's just Lua.
I understand this. when i attempted to do this, i received some errors. My assumption was that there was some limitations with AceDB. I must have missed something else.
I have not coded in almost 15 years so I am finding myself having to relearn some things. I apologize if it seems i am asking stupid questions.
CiscOH
this might be because you mixed numbers and letters. this dosn't work in lua too well.
self.db.global["container1"]["var1"]
self.db.global["container1"]["subcontainer1"].varx
self.db.global["container2"]["var2"]
lua don't like it too well when u mix letters and numbers in a table key.
i understand that.
i was trying to created a table at:
self.db.global.roster.name
self.db.global.roster.rank
self.db.global.bank.guildID
the error i got was to the effect that global was a nil value.
i have completely re-written that part of the code.
i will be trying o do this againand will post the errorrs here.
CiscOH
or initilized the AceDB on your addon..
Huh? Lua doesn't care about that. Any acceptable variable name works equally fine as a key.
This sounds like you might have gotten Ace2 by accident, where (IIRC) "global" wasn't one of the default subkeys.
edit: or not init'd the DB like they said above, hadn't thought of that.
self.db.char.name
self.db.global.test
It is only when i want to hang a table of global that i get the error.
I should not be able to use anything if the DB was not initialized.....right?
CiscOH
Show us code, and we can help you. We're not telepathic. :-)
will throw an error since container has not been initialized as a table
works because lua knows that container is a table
though you should use this if you are declaring these things within your code since its faster