mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Allow dumping userdata (#7012)
This commit is contained in:
parent
bb28afcfc3
commit
7725030067
@ -120,7 +120,12 @@ end
|
|||||||
-- The dumped and level arguments are internal-only.
|
-- The dumped and level arguments are internal-only.
|
||||||
|
|
||||||
function dump(o, indent, nested, level)
|
function dump(o, indent, nested, level)
|
||||||
if type(o) ~= "table" then
|
local t = type(o)
|
||||||
|
if not level and t == "userdata" then
|
||||||
|
-- when userdata (e.g. player) is passed directly, print its metatable:
|
||||||
|
return "userdata metatable: " .. dump(getmetatable(o))
|
||||||
|
end
|
||||||
|
if t ~= "table" then
|
||||||
return basic_dump(o)
|
return basic_dump(o)
|
||||||
end
|
end
|
||||||
-- Contains table -> true/nil of currently nested tables
|
-- Contains table -> true/nil of currently nested tables
|
||||||
|
Loading…
Reference in New Issue
Block a user