From 9aedb17371c7d77b4577c496654b9edf8f5bddb1 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 13 Apr 2017 12:41:30 +1000 Subject: lua-cli: Introduce support for multiline --- tests/manual-tests/lua-cli.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/manual-tests') 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("")) { + /* 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); -- cgit v1.2.3-70-g09d2