MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / multiline

Function multiline

3rd/lua-5.4.3/src/lua.c:522–535  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

520** Read multiple lines until a complete Lua statement
521*/
522static int multiline (lua_State *L) {
523 for (;;) { /* repeat until gets a complete statement */
524 size_t len;
525 const char *line = lua_tolstring(L, 1, &len); /* get what it has */
526 int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */
527 if (!incomplete(L, status) || !pushline(L, 0)) {
528 lua_saveline(L, line); /* keep history */
529 return status; /* cannot or should not try to add continuation line */
530 }
531 lua_pushliteral(L, "\n"); /* add newline... */
532 lua_insert(L, -2); /* ...between the two lines */
533 lua_concat(L, 3); /* join them */
534 }
535}
536
537
538/*

Callers 1

loadlineFunction · 0.85

Calls 4

lua_tolstringFunction · 0.85
incompleteFunction · 0.85
pushlineFunction · 0.85
lua_concatFunction · 0.85

Tested by

no test coverage detected