[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Feeding data into a lua state: in chunks?
- From: Joseph Stewart <joseph.stewart@...>
- Date: Tue, 15 May 2012 18:45:51 -0400
w.r.t. to telnet line handling, it's negotiable but usually it's per-character (otherwise tools like 'vi' would be pretty crummy to use)
On Tue, May 15, 2012 at 3:21 PM, Bruce Wheaton <email@example.com>
Sorry if this is a stupid question, but it seems that I have to feed data into the lua vm in whole chunks?
My problem is that my existing code takes incoming socket data and splits it into lines, then each line is fed into lua. But a lua snippet will generally have new lines in it.
I can not send the data to lua on every new line, but then I'm uncertain about how to decide when to trigger the lua state pcall.
I guess I could have lua handle the prompt? So the lua VM is always in control? I'm looking at lua.c and it seems to implement that approach. I guess I need to re-implment the 'dotty' method in that case, and then try to re-direct the io so that it can go out of the socket instead of the console?
hmm. I wonder if telnet just sends per character, or when I hit enter?