Skip to content

Commit a6bb2c4

Browse files
HybridDogSmallJoker
authored andcommittedFeb 8, 2018
Allow dumping userdata (#7012)
1 parent 501f936 commit a6bb2c4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎builtin/common/misc_helpers.lua

+6-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,12 @@ end
120120
-- The dumped and level arguments are internal-only.
121121

122122
function dump(o, indent, nested, level)
123-
if type(o) ~= "table" then
123+
local t = type(o)
124+
if not level and t == "userdata" then
125+
-- when userdata (e.g. player) is passed directly, print its metatable:
126+
return "userdata metatable: " .. dump(getmetatable(o))
127+
end
128+
if t ~= "table" then
124129
return basic_dump(o)
125130
end
126131
-- Contains table -> true/nil of currently nested tables

0 commit comments

Comments
 (0)