| |
It would appear one of the old SavedVariables breaking bugs is back, Maldivia noticed that table keys break the client, and so I updated my BreakSV test addon, and tried a bunch of other fringe cases along with Qzot and krka (and possibly others) on IRC.
Anyway, to summarize, the general consensus on IRC over preferred behaviour is as follows:
As KEYS:
Keys that are tables, functions, userdata, or infinite numeric values, should just cause the entire entry to NOT be serialized. If possible a comment in the SV file like --[[ Skipped entry with table key]] would be great, but it's not required.
None of the current mappings are entirely robust or very useful, I think the efforts to maintain stuff like function keys, while appreciated, have too many holes and possibles of nil key failures during subsequent logins to be valuable.
As VALUES:
Values that are functions, userdata, or infinite numeric values should all be serialized as nil, with a comment. Currently functions are the only exception to this. I could see the 'emit global symbol if it has one' rule being possibly useful, but I dont think it's worth the potential for strangeness due to aliasing. The general consensus was that something like nil -- [[ Cannot write inline function ]] and nil -- [[ Cannot write function CastSpellByName ]] would be more consistent and reliable.
The new recursive table detection is nice, but I think instead of emitting an empty table with a comment inside, it'd be safer to emit just the comment and no table (Okay, i'll admit this one bit me, quite unexpectedly, but my addon would have failed more informatively with a missing table than an empty one). So instead of
X = {}; Y = {}; X.Y = Y; Y.Y = X;
producing:
BreakSVData = {
["X"] = {
["Y"] = {
["X"] = { --[[ Recursive Table ]] },
},
},
}
It should produce
BreakSVData = {
["X"] = {
["Y"] = {
["X"] = nil --[[ Recursive Table Reference ]],
},
},
}
(The last part is just MY suggestion, the other stuff came from group discussions)
<Addon Authors: RegisterForSave() is going away!>
|