WoWInterface SVN LibDefaults

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 6 to Rev 7
    Reverse comparison

Rev 6 → Rev 7

LibDefaults/LibDefaults.lua
9,8 → 9,8
-Saved Variable Initialization Library
 
Change List
v1.0
- Hopefully one version is enough!
v2.1
- Fixed a bug that broke non-table defaults
v2.0
- Added Meta-Indexing
Defaults are only saved in the default storage, not in the main table,
20,13 → 20,15
- Added Default Unloading
Removes defaults from the saved variables so that they aren't saved to disk. Speed up load time, yay!
- Added lib:Reset(addonName, varName) to reset an addons variable to default (and all table values to default)
v1.0
- Hopefully one version is enough!
 
$Date: 2007-07-03 21:22:03 -0500 (Tue, 03 Jul 2007) $
$Rev: 5009 $
 
]]--
 
local lib, oldminor = LibStub:NewLibrary("LibDefaults", 2 )
local lib, oldminor = LibStub:NewLibrary("LibDefaults", 2.1 )
if not lib then return end
 
local print, quoteString, tableKeyValue, hashsize
134,8 → 136,17
-- Initialize Variables that are nil
for i, set in ipairs(self.addonVars[addonName]) do
varName = set.varName
 
--Backup Defaults
recursInit(storage, _G, varName, unpack(set.value))
_G[varName] = getMetaIndex(_G[varName], storage[varName])
 
if #(set.value) == 1 and type(set.value[1]) ~= "table" then
-- Just init non-tables
_G[varName] = set.value[1]
else
-- Recursive Meta-Indexing
_G[varName] = getMetaIndex(_G[varName], storage[varName])
end
end
-- Empty the list
self.addonVars[addonName] = nil
LibDefaults/LibDefaults.toc
2,7 → 2,7
## Title: LibDefaults
## Notes: Saved Variable Initialization Library
## Author: AnduinLothar
## Version: 2.0
## Version: 2.1
## X-Revision: $Rev: 5127 $
## X-Date: $Date: 2007-11-13 18:34:54 -0600 (Tue, 13 Nov 2007) $
## X-Category: Library