1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2025-06-28 06:11:47 +02:00

[mesecons] Update; fix #446

This commit is contained in:
LeMagnesium
2016-05-16 18:09:13 +02:00
parent 6e3a9352c9
commit e12cee32c5
98 changed files with 68 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -229,23 +229,35 @@ end
local function remove_functions(x)
local tp = type(x)
if tp == "table" then
if tp == "function" then
return nil
end
-- Make sure to not serialize the same table multiple times, otherwise
-- writing mem.test = mem in the LuaController will lead to infinite recursion
local seen = {}
local function rfuncs(x)
if seen[x] then return end
seen[x] = true
if type(x) ~= "table" then return end
for key, value in pairs(x) do
local key_t, val_t = type(key), type(value)
if key_t == "function" or val_t == "function" then
if type(key) == "function" or type(value) == "function" then
x[key] = nil
else
if key_t == "table" then
remove_functions(key)
if type(key) == "table" then
rfuncs(key)
end
if val_t == "table" then
remove_functions(value)
if type(value) == "table" then
rfuncs(value)
end
end
end
elseif tp == "function" then
return nil
end
rfuncs(x)
return x
end