savedvariables refactoring

This commit is contained in:
Manuel Simon Hirsig
2017-03-18 15:13:12 +01:00
parent ca9c897bf6
commit 31ec5cbb97
4 changed files with 36 additions and 32 deletions
+2 -2
View File
@@ -34,9 +34,9 @@ do
end
for scope in temp-S('player', 'faction', 'realm', 'account') do
local scope = scope
M[scope] = function(k)
M[scope] = function(k, v)
if not cache[scope] then error('Cache not ready', 2) end
cache[scope][k] = cache[scope][k] or {}
cache[scope][k] = cache[scope][k] or v or {}
return cache[scope][k]
end
end