aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-29 13:59:37 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-29 13:59:37 -0200
commitc6fedc92f8b1c3e73d835f7641bffe4b199f0dd1 (patch)
treead8eaa0f030293a8f0425aacb6eda99225940816
parent68af7cc81aea60b1030e796c39be37efd7e10195 (diff)
downloadlua-c6fedc92f8b1c3e73d835f7641bffe4b199f0dd1.tar.gz
lua-c6fedc92f8b1c3e73d835f7641bffe4b199f0dd1.tar.bz2
lua-c6fedc92f8b1c3e73d835f7641bffe4b199f0dd1.zip
new command 'print' (to print literal strings) in mini-language
-rw-r--r--ltests.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ltests.c b/ltests.c
index 130f5d6b..513c846b 100644
--- a/ltests.c
+++ b/ltests.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltests.c,v 2.236 2017/12/11 18:55:31 roberto Exp roberto $ 2** $Id: ltests.c,v 2.237 2017/12/15 18:53:48 roberto Exp roberto $
3** Internal Module for Debugging of the Lua Implementation 3** Internal Module for Debugging of the Lua Implementation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -1377,7 +1377,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
1377 else if EQ("pop") { 1377 else if EQ("pop") {
1378 lua_pop(L1, getnum); 1378 lua_pop(L1, getnum);
1379 } 1379 }
1380 else if EQ("print") { 1380 else if EQ("printstack") {
1381 int n = getnum; 1381 int n = getnum;
1382 if (n != 0) { 1382 if (n != 0) {
1383 printf("%s\n", luaL_tolstring(L1, n, NULL)); 1383 printf("%s\n", luaL_tolstring(L1, n, NULL));
@@ -1385,6 +1385,10 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
1385 } 1385 }
1386 else printstack(L1); 1386 else printstack(L1);
1387 } 1387 }
1388 else if EQ("print") {
1389 const char *msg = getstring;
1390 printf("%s\n", msg);
1391 }
1388 else if EQ("pushbool") { 1392 else if EQ("pushbool") {
1389 lua_pushboolean(L1, getnum); 1393 lua_pushboolean(L1, getnum);
1390 } 1394 }