Allow dumping userdata (#7012)

This commit is contained in:
you 2018-02-08 19:17:06 +01:00 committed by SmallJoker
parent 501f936b37
commit a6bb2c4ea8
1 changed files with 6 additions and 1 deletions

View File

@ -120,7 +120,12 @@ end
-- The dumped and level arguments are internal-only.
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)
end
-- Contains table -> true/nil of currently nested tables