[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Fun (Was: [ANN] Lua 5.3.0 (work2) now available)
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 28 Mar 2014 09:23:00 +0200
On Thu, Mar 27, 2014 at 6:05 PM, Coda Highland <chighland@gmail.com> wrote:
> I didn't know about that, but he was actually talking about the other
> way around -- make the interpreter ignore a leading > if you're
> copy-pasting a session from an e-mail into the terminal window.
And here is a patch for that case, specially for Dirk ;)
--- lua.c Fri Mar 28 09:17:51 2014
+++ old\lua.c Wed Feb 26 17:27:56 2014
@@ -273,19 +273,13 @@
/* prompt the user, read a line, and push it into the Lua stack */
static int pushline (lua_State *L, int firstline) {
char buffer[LUA_MAXINPUT];
- char *b = buffer, *B;
+ char *b = buffer;
size_t l;
const char *prmt = get_prompt(L, firstline);
int readstatus = lua_readline(L, b, prmt);
if (readstatus == 0)
return 0; /* no input (prompt will be popped by caller) */
lua_pop(L, 1); /* remove prompt */
- B = b;
- if (*b == '>') {
- ++b;
- if (*b == '>')
- ++b;
- }
l = strlen(b);
if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
b[l-1] = '\0'; /* remove it */
@@ -293,7 +287,7 @@
lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */
else
lua_pushstring(L, b);
- lua_freeline(L, B);
+ lua_freeline(L, b);
return 1;
}