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
|
||||
return
|
||||
end
|
||||
local count = counts[val]
|
||||
if not recount then
|
||||
local count = counts[val]
|
||||
counts[val] = (count or 0) + 1
|
||||
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
|
||||
type_lookup[val] = core.known_metatables[mt]
|
||||
count_values(val, true)
|
||||
elseif type_ == "table" then
|
||||
for k, v in pairs(val) do
|
||||
count_values(k)
|
||||
count_values(v)
|
||||
if recount or not count then
|
||||
for k, v in pairs(val) do
|
||||
count_values(k)
|
||||
count_values(v)
|
||||
end
|
||||
end
|
||||
elseif type_ ~= "string" then
|
||||
elseif type_ ~= "string" and type_ ~= "function" then
|
||||
error("unsupported type: " .. type_)
|
||||
end
|
||||
end
|
||||
count_values(value, false)
|
||||
count_values(value)
|
||||
return counts, type_lookup
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue