Skip to content

Commit 24c8b6b

Browse files
author
Sheridan C Rawlins
committed
Remove metatables when inspecting.
1 parent 5bbe521 commit 24c8b6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

json/example_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ func ExampleDecode() {
1818
local jsonString = [[{"a":{"b":1}}]]
1919
local result, err = json.decode(jsonString)
2020
if err then error(err) end
21-
print(inspect(result, {newline="", indent=""}))
21+
local remove_all_metatables = function(item, path)
22+
if path[#path] ~= inspect.METATABLE then return item end
23+
end
24+
print(inspect(result, {process = remove_all_metatables, newline="", indent=""}))
2225
`
2326
if err := state.DoString(source); err != nil {
2427
log.Fatal(err.Error())

0 commit comments

Comments
 (0)