- restored previous changes; cleanup workspace
This commit is contained in:
+11
-9
@@ -1,9 +1,9 @@
|
||||
-- read namespace from global env
|
||||
local _G = _G
|
||||
local _G = _G or getfenv()
|
||||
local Grichelde = _G.Grichelde or {}
|
||||
|
||||
local pairs, tInsert, tClone, unpack, join, toString
|
||||
= Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
|
||||
local pairs, tInsert, tClone, tSize, unpack, join, toString
|
||||
= Grichelde.F.pairs, Grichelde.F.tInsert, Grichelde.F.tClone, Grichelde.F.tSize, Grichelde.F.unpack, Grichelde.F.join, Grichelde.F.toString
|
||||
|
||||
function Grichelde.getDefaultConfig()
|
||||
return {
|
||||
@@ -84,38 +84,40 @@ end
|
||||
|
||||
function Grichelde:SyncToDatabase(info, val)
|
||||
self:TracePrint("SyncToDatabase : info")
|
||||
for i = 0, #info do
|
||||
local n = tSize(info)
|
||||
for i = 0, n do
|
||||
self:TracePrint("%d = %s", i, info[i])
|
||||
end
|
||||
|
||||
local option = self.db.profile
|
||||
local path = 1
|
||||
while (path < #info) do
|
||||
while (path < n) do
|
||||
if (info[path] ~= "mappings") then
|
||||
option = option[info[path]]
|
||||
end
|
||||
path = path + 1
|
||||
end
|
||||
local optionPath = join(".", unpack(info, 1, #info))
|
||||
local optionPath = join(".", unpack(info, 1, n))
|
||||
self:DebugPrint("change option \"%s\" from %s to %s", optionPath, toString(option[info[path]]), toString(val))
|
||||
option[info[path]] = val
|
||||
end
|
||||
|
||||
function Grichelde:ReadFromDatabase(info)
|
||||
self:TracePrint("ReadFromDatabase : info")
|
||||
for i = 0, #info do
|
||||
local n = tSize(info)
|
||||
for i = 0, n do
|
||||
self:TracePrint("%d = %s", i, info[i])
|
||||
end
|
||||
|
||||
local option = self.db.profile
|
||||
local path = 1
|
||||
while (path <= #info) do
|
||||
while (path <= n) do
|
||||
if (info[path] ~= "mappings") then
|
||||
option = option[info[path]]
|
||||
end
|
||||
path = path + 1
|
||||
end
|
||||
local optionPath = join(".", unpack(info, 1, #info))
|
||||
local optionPath = join(".", unpack(info, 1, n))
|
||||
self:DebugPrint("read option \"%s\": %s", optionPath, toString(option))
|
||||
return option
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user