Repository navigation
Conversation
This reverts commit 9161aab.
|
Hi, and thanks for the PR! Could you tell me a little bit about your changes? What kinds of things are you trying to do with lua-repl that weren't possible or easy with the previous API? |
|
Hi, I'm using Lua REPL to implement a embedded Lua console accessible over a socket. It seemed natural to derive the console from I've however changed my console to derive from Sorry for the noise, and thanks for this module. I'm using it together with lua-term and luasockets, and it's making my life a lot easier. I also wanted to use lua-linenoise, but it seems to be tied to |
|
No need to apologize - I'm glad Lua REPL is working for you! You're right about deriving from As far as prettyprint is concerned, I agree - it needs a change to work properly with what you have in mind (which, by the way, is a really good idea - I've been meaning to embed Lua REPL into AwesomeWM for...some time now, but As far using lua-linenoise goes, what does your socket client look like? Maybe I could help you get linenoise working there! |
The other PR only uses
Yeah I think an easy way to have a reusable REPL is to have it take a function to read lines from, and another to write strings to, and maybe another one to report errors. With that design you can leverage the module to work with all scenarios I can think of. You module sort of works like that though, but it needs more tweaking i.e. override the
I simply override With
Thank you! When I added the plugin, I could only issue commands on the terminal where the server was running, because linenoise reads from I know it's perfectly possible to do that kind of line editing over a socket, but I have no idea of the amount of work involved in that. |
|
So I had a long think about this a day or two ago, and I came up with a design that I think will be more flexible going forward. I have to experiment with this design in code to feel more certain, but I have a good feeling. The summary is roughly this:
I'm not sure how prompting will work with this - I'm going to try making this change and seeing if plugins break in interesting ways, or if writing other REPL embeddings break in interesting ways as well. I don't have time for this this week, but I'll try to do it next week! |
Out of curiosity, do you have a single REPL object per socket, or are all of the sockets talking to a single REPL object? |
|
@leiradel As far as linenoise over a socket goes, one option would be to have the client itself embed a line editor like linenoise. I might be wrong on this, but I don't think the server process will be able to configure the client's terminal properly to let something like linenoise do its job if the client is just something like netcat. |
|
I'm not sold on the reply context, I think it's easy enough to create multiple REPLs, each one talking to its own connection, and avoids having to maintain per-connection state in the REPL.
For now I only support one connection, but if I need to support multiple connections I'll create a REPL per socket. It feels like the right thing to do instead of trying to make the same REPL talk to every socket.
My client is telnet :) |
|
@leiradel That's a good point - I think I'll hold off on the "reply context" idea, then! As far as the linenoise over network thing goes - if your client is telnet, I don't think there's a way to get it working, at least not to my knowledge :( |
|
Yeah I think I'll try to write something similar to linenoise and then a Lua REPL plugin for it. Command history and line editing would be already life savers! |
No description provided.