When "inspecting" a table with a __tostring metamethod, e.g. by evaluating a Jupyter cell, I would expect it to "respect" the representation established by the meta method. What it does instead is mixing the tostring-value with a dump of the entire table. This can look very ugly especially for large objects. Just to clarify using the Lua 5.2 interpreter:
The output is the same in ILua. Using the latest version of inspect.lua v3.1.3 is even worse since it entirely omits the tostring-representation after --. Also since they use Teal in recent versions, it might even be tricky to bundle a readable preprocessed version of inspect.lua v3.1.3 with ILua.
For the time being, I have patched my inspect.lua. Perhaps we should always check whether the inspected value contains a __tostring metamethod and only if not pass it to the inspect-library at all. But @guysv might have differing strong opinions about that.
When "inspecting" a table with a __tostring metamethod, e.g. by evaluating a Jupyter cell, I would expect it to "respect" the representation established by the meta method. What it does instead is mixing the tostring-value with a dump of the entire table. This can look very ugly especially for large objects. Just to clarify using the Lua 5.2 interpreter:
The output is the same in ILua. Using the latest version of inspect.lua v3.1.3 is even worse since it entirely omits the tostring-representation after
--
. Also since they use Teal in recent versions, it might even be tricky to bundle a readable preprocessed version of inspect.lua v3.1.3 with ILua.For the time being, I have patched my inspect.lua. Perhaps we should always check whether the inspected value contains a __tostring metamethod and only if not pass it to the inspect-library at all. But @guysv might have differing strong opinions about that.
I could prepare a merge request.