summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-02-05 12:22:55 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-02-05 12:22:55 -0200
commit1721d09ac8e55bb4b675cea26cbe6b707fd21a2c (patch)
tree14a418ac50b6b54d1a2a5051a0caa11cdc1e62ea
parent2f3da00e514068ab301c72ae0f07383b8a609c71 (diff)
downloadlua-1721d09ac8e55bb4b675cea26cbe6b707fd21a2c.tar.gz
lua-1721d09ac8e55bb4b675cea26cbe6b707fd21a2c.tar.bz2
lua-1721d09ac8e55bb4b675cea26cbe6b707fd21a2c.zip
still accepts initial '=' for expressions, for compatibility with old
versions (and old habits...)
-rw-r--r--lua.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lua.c b/lua.c
index 70f7cc24..e0ca0669 100644
--- a/lua.c
+++ b/lua.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lua.c,v 1.207 2013/10/07 14:20:31 roberto Exp roberto $ 2** $Id: lua.c,v 1.208 2013/12/16 14:27:17 roberto Exp roberto $
3** Lua stand-alone interpreter 3** Lua stand-alone interpreter
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -270,7 +270,10 @@ static int pushline (lua_State *L, int firstline) {
270 l = strlen(b); 270 l = strlen(b);
271 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ 271 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
272 b[l-1] = '\0'; /* remove it */ 272 b[l-1] = '\0'; /* remove it */
273 lua_pushstring(L, b); /* save line in Lua */ 273 if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */
274 lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */
275 else
276 lua_pushstring(L, b);
274 lua_freeline(L, b); 277 lua_freeline(L, b);
275 return 1; 278 return 1;
276} 279}