[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Feeding data into a lua state: in chunks?
- From: Bruce Wheaton <bruce@...>
- Date: Tue, 15 May 2012 12:21:21 -0700
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?