Don't delete custom lines when restoring to defaults
Scott Sibley [08-17-10 - 04:42]
Don't delete custom lines when restoring to defaults
diff --git a/Modules/Text.lua b/Modules/Text.lua
index ec98551..e27dd3a 100644
--- a/Modules/Text.lua
+++ b/Modules/Text.lua
@@ -680,9 +680,17 @@ function mod:RebuildOpts()
desc = "Roll back to defaults.",
type = "execute",
func = function()
- self.db.profile.lines = {}
for i, v in ipairs(defaultLines) do
- tinsert(self.db.profile.lines, v)
+ local replaced
+ for j, vv in ipairs(self.db.profile.lines) do
+ if v.name == vv.name then
+ self.db.profile.lines[j] = v
+ replaced = true
+ end
+ end
+ if not replaced then
+ tinsert(self.db.profile.lines, v)
+ end
end
self:RebuildOpts()
StarTip:RebuildOpts()