mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
fixup
This commit is contained in:
parent
e713d5291d
commit
738b3cfadc
1 changed files with 9 additions and 7 deletions
|
@ -31,24 +31,26 @@ local function prepare_objects(value)
|
||||||
if type_ == "boolean" or type_ == "number" then
|
if type_ == "boolean" or type_ == "number" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
local count = counts[val]
|
||||||
if not recount then
|
if not recount then
|
||||||
local count = counts[val]
|
|
||||||
counts[val] = (count or 0) + 1
|
counts[val] = (count or 0) + 1
|
||||||
end
|
end
|
||||||
local mt = (not recount) and (type_ == "table" or type_ == "userdata") and getmetatable(val)
|
local mt = (not count) and (type_ == "table" or type_ == "userdata") and getmetatable(val)
|
||||||
if mt and core.known_metatables[mt] then
|
if mt and core.known_metatables[mt] then
|
||||||
type_lookup[val] = core.known_metatables[mt]
|
type_lookup[val] = core.known_metatables[mt]
|
||||||
count_values(val, true)
|
count_values(val, true)
|
||||||
elseif type_ == "table" then
|
elseif type_ == "table" then
|
||||||
for k, v in pairs(val) do
|
if recount or not count then
|
||||||
count_values(k)
|
for k, v in pairs(val) do
|
||||||
count_values(v)
|
count_values(k)
|
||||||
|
count_values(v)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif type_ ~= "string" then
|
elseif type_ ~= "string" and type_ ~= "function" then
|
||||||
error("unsupported type: " .. type_)
|
error("unsupported type: " .. type_)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
count_values(value, false)
|
count_values(value)
|
||||||
return counts, type_lookup
|
return counts, type_lookup
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue