MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / multiline

Function multiline

third-party/lua-5.4.6/src/lua.c:546–560  ·  view source on GitHub ↗

** Read multiple lines until a complete Lua statement */

Source from the content-addressed store, hash-verified

544** Read multiple lines until a complete Lua statement
545*/
546static int multiline (lua_State *L) {
547 for (;;) { /* repeat until gets a complete statement */
548 size_t len;
549 const char *line = lua_tolstring(L, 1, &len); /* get what it has */
550 int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */
551 if (!incomplete(L, status) || !pushline(L, 0)) {
552 lua_saveline(L, line); /* keep history */
553 return status; /* should not or cannot try to add continuation line */
554 }
555 lua_remove(L, -2); /* remove error message (from incomplete line) */
556 lua_pushliteral(L, "\n"); /* add newline... */
557 lua_insert(L, -2); /* ...between the two lines */
558 lua_concat(L, 3); /* join them */
559 }
560}
561
562
563/*

Callers 1

loadlineFunction · 0.70

Calls 8

luaL_loadbufferFunction · 0.85
lua_savelineFunction · 0.85
lua_tolstringFunction · 0.70
incompleteFunction · 0.70
pushlineFunction · 0.70
lua_concatFunction · 0.70
lua_removeFunction · 0.50
lua_insertFunction · 0.50

Tested by

no test coverage detected