summaryrefslogtreecommitdiff
path: root/tests/manual-tests/lua-cli.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-04-13 12:41:30 +1000
committerdaurnimator <quae@daurnimator.com>2017-04-19 17:25:21 +1000
commit9aedb17371c7d77b4577c496654b9edf8f5bddb1 (patch)
tree0f335aa52a552239a6337623f60c48841acb1ff3 /tests/manual-tests/lua-cli.js
parent2dbacc0031513a110c3ea62afb086020184150e7 (diff)
downloadfengari-9aedb17371c7d77b4577c496654b9edf8f5bddb1.tar.gz
fengari-9aedb17371c7d77b4577c496654b9edf8f5bddb1.tar.bz2
fengari-9aedb17371c7d77b4577c496654b9edf8f5bddb1.zip
lua-cli: Introduce support for multiline
Diffstat (limited to 'tests/manual-tests/lua-cli.js')
-rwxr-xr-xtests/manual-tests/lua-cli.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/manual-tests/lua-cli.js b/tests/manual-tests/lua-cli.js
index a8f1928..f93f306 100755
--- a/tests/manual-tests/lua-cli.js
+++ b/tests/manual-tests/lua-cli.js
@@ -38,6 +38,15 @@ for (;;) {
status = lua.thread_status.LUA_OK;
}
}
+ while (status === lua.thread_status.LUA_ERRSYNTAX && lapi.lua_tojsstring(L, -1).endsWith("<eof>")) {
+ /* continuation */
+ lapi.lua_pop(L, 1);
+ input += "\n" + readlineSync.prompt({
+ prompt: '>> '
+ });
+ let buffer = lua.to_luastring(input);
+ status = lauxlib.luaL_loadbuffer(L, buffer, buffer.length, stdin);
+ }
if (status !== lua.thread_status.LUA_OK) {
lauxlib.lua_writestringerror(`${lapi.lua_tojsstring(L, -1)}\n`);
lapi.lua_settop(L, 0);