Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow dumping userdata (#7012)
  • Loading branch information
HybridDog authored and SmallJoker committed Feb 8, 2018
1 parent 501f936 commit a6bb2c4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion builtin/common/misc_helpers.lua
Expand Up @@ -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
Expand Down

0 comments on commit a6bb2c4

Please sign in to comment.