@@ -89,8 +89,13 @@ local function dump_(prefix, value, maxlen, level, add)
8989 local typ = (({boolean = 1 , number = 1 , string = 1 , table = 1 , userdata = 1 })
9090 [typename ] and ' ' or typename )
9191
92+ -- light userdata is just a pointer (can't iterate over it)
93+ -- XXX is there a better way of checking for light userdata?
94+ if type (value ) == ' userdata' and not pcall (pairs (value )) then
95+ value = ' <pointer>'
96+
9297 -- modify the value heuristically
93- if ({table = 1 , userdata = 1 })[type (value )] then
98+ elseif ({table = 1 , userdata = 1 })[type (value )] then
9499 local valueCopy , numKeys , lastKey = {}, 0 , nil
95100 for key , val in pairs (value ) do
96101 -- pandoc >= 2.15 includes 'tag', nil values and functions
@@ -125,6 +130,10 @@ local function dump_(prefix, value, maxlen, level, add)
125130 local quo = typename == ' string' and ' "' or ' '
126131 add (string.format (' %s%s%s%s%s%s%s%s' , indent , prefix , presep , typ ,
127132 typsep , quo , value , quo ))
133+ -- light userdata is just a pointer (can't iterate over it)
134+ -- XXX is there a better way of checking for light userdataXS?
135+ elseif valtyp == ' userdata' and not pcall (pairs (value )) then
136+ add (string.format (' %s%s%s%s <pointer>' , indent , prefix , presep , typ ))
128137 elseif ({table = 1 , userdata = 1 })[valtyp ] then
129138 add (string.format (' %s%s%s%s%s{' , indent , prefix , presep , typ , typsep ))
130139 -- Attr and Attr.attributes have both numeric and string keys, so
0 commit comments