hoelzro / lua-repl

A Lua REPL implemented in Lua for embedding in other programs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pretty print cannot handle function

dpashkevich opened this issue · comments

Thanks for working on the repl!

You're probably aware of this but I'm opening this issue just for the record.
The pretty_print plugin throws an error when trying to pretty print a function:

...plugins/pretty_print.lua:184: Cannot print type 'function'

There should at least be some sort of stub for this so the repl is usable for debugging, since many real-world tables would contain functions...

@dpashkevich Thanks for looking at the REPL, and reporting this issue! I have been thinking about a more general way to handle this issue, but in the meantime, I have fixed this issue. Expect a release to follow shortly!

I just came across inspect.lua (also available via luarocks).
You may want to use it for your plugin.

@dpashkevich Thanks for the suggestion! I'll investigate inspect.lua.

@dpashkevich I took a look at inspect.lua, and I think that I'll stick with the pretty printer bundled with the lua-repl source to avoid additional external dependencies. However, if you prefer the way inspect.lua does things, you may certainly write a lua-repl plugin to use it!

Thanks for letting know. I didn't really look into inspect.lua's dependencies, I just randomly came across it on luarocks while searching for a generic inspect function to use in debugging. I'll be happy to use whatever you come up with in lua-repl :)