|
|
@ -165,27 +165,36 @@ local function makePath(path, ...) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local function processRecursive(process, item, path) |
|
|
|
local function processRecursive(process, item, path) |
|
|
|
|
|
|
|
local visited = {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local function processRecursive2(item, path) |
|
|
|
if item == nil then return nil end |
|
|
|
if item == nil then return nil end |
|
|
|
|
|
|
|
if visited[item] then return visited[item] end |
|
|
|
|
|
|
|
|
|
|
|
local processed = process(item, path) |
|
|
|
local processed = process(item, path) |
|
|
|
if type(processed) == 'table' then |
|
|
|
if type(processed) == 'table' then |
|
|
|
local processedCopy = {} |
|
|
|
local processedCopy = {} |
|
|
|
|
|
|
|
visited[item] = processedCopy |
|
|
|
local processedKey |
|
|
|
local processedKey |
|
|
|
|
|
|
|
|
|
|
|
for k,v in pairs(processed) do |
|
|
|
for k,v in pairs(processed) do |
|
|
|
processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY)) |
|
|
|
processedKey = processRecursive2(k, makePath(path, k, inspect.KEY)) |
|
|
|
if processedKey ~= nil then |
|
|
|
if processedKey ~= nil then |
|
|
|
processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey)) |
|
|
|
processedCopy[processedKey] = processRecursive2(v, makePath(path, processedKey)) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE)) |
|
|
|
local mt = processRecursive2(getmetatable(processed), makePath(path, inspect.METATABLE)) |
|
|
|
setmetatable(processedCopy, mt) |
|
|
|
setmetatable(processedCopy, mt) |
|
|
|
processed = processedCopy |
|
|
|
processed = processedCopy |
|
|
|
end |
|
|
|
end |
|
|
|
return processed |
|
|
|
return processed |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return processRecursive2(item, path) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
------------------------------------------------------------------- |
|
|
|
------------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
|
|