|
I think this is because in lua.c, pushline()
checks just the first character for = "" possible
whitespace.
This simple patch works for me (but there could
be a simpler patch).
--- lua.c
+++ lua.c @@ -314,12 +314,14 @@ return 0; /* no input (prompt will be popped by caller) */ lua_pop(L, 1); /* remove prompt */ l = strlen(b); if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ b[--l] = '\0'; /* remove it */ - if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ - lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ + int i = 0; + while (b[i] == ' ' || b[i] == '\t') i++; + if (firstline && b[i] == '=') /* for compatibility with 5.2, ... */ + lua_pushfstring(L, "return %s", b + i + 1); /* change '=' to 'return' */ else lua_pushlstring(L, b, l); lua_freeline(L, b); return 1; } From: Egor Skriptunoff
Sent: Sunday, April 30, 2017 9:33 PM
To: Lua mailing list
Subject: Re: [bug?] = doesn't work properly On Sun, Apr 30, 2017 at 7:04 PM, Soni L. <fakedme@gmail.com> wrote: $ lua Yes, it looks like a bug. |