Hi, In my little addons I used a files categories.lua where the users define the custom mounts or pets to be summoned.
The structure is very simple:
Lua Code:
mounts = {
flying = {
"Draco Del Crepuscolo",
"Draco Rosso",
"Fenice Oscura",
"Proto-Draco Ferroso",
},
ground = {
"Fiera della Luna Rapida",
"Fiera della Nebbia Rapida",
"Fiera della Notte Striata",
},
[etc etc ...]
}
Now I'd like to try to move and replicate this data structure into the addons to use the WTF store method. But what I think was easy is not so easy.
Let's suppose I wanna add a mount in a category not yet defined with the syntax:
/mrc add new_category Swift Moonsaber
The parsing should be ok and suppose I have:
Lua Code:
mounts = {}
category="new_category"
mount="Swift Moonsaber"
I thought that it could be simple as push a new entry in this way:
Lua Code:
mounts[category][mount]=true
but here lua complain something about attempt to index field '?' (a nil value).
I try also with table.insert without any fortune.
I don't think things change so much removing one level ( categories[mount]=true ) being this to be pushed inside the mounts{} to be saved later.
Thanks in advance for your patience.