[ADDON BUG] Sub-table in Saved Variables
by Ceil | 12/04/2007 17:46:11![]() An addon's TOC file seems to allow using a sub-table in the SavedVariables list, but an error occurs when loading it because the primary table is never created prior to creating the sub-table. By sub-table, I mean something to the effect of Foo.Bar = {} (where Bar is the sub-table of Foo). The following should help to demonstrate this bug: Addon.toc
Addon.lua
Reload SavedVariables\Addon.lua
And, finally, the error message is revealed: WTF\Account\<Name>\SavedVariables\Addon.lua:2: attempt to index global 'Foo' (a nil value) The problem is that the saved variables script is trying to create Foo.Bar when Foo doesn't yet exist (it's nil). So when creating this file, it'll need to look through and create the other tables.
And then a more complicated structure like Addon.Table.Something.Elsewould be:
|
by Slouken | 13/04/2007 22:38:12![]() Foo.Bar isn't legal saved variable syntax. It looks the entire name up in the global namespace and saves that. e.g. print _G["Foo.Bar"] will always yield nil ... unless you're doing some really wacky things. :) |


Recent Blizzard Announcements