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

Function multiline

third-party/lua-5.3.5/src/lua.c:350–363  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

348** Read multiple lines until a complete Lua statement
349*/
350static int multiline (lua_State *L) {
351 for (;;) { /* repeat until gets a complete statement */
352 size_t len;
353 const char *line = lua_tolstring(L, 1, &len); /* get what it has */
354 int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */
355 if (!incomplete(L, status) || !pushline(L, 0)) {
356 lua_saveline(L, line); /* keep history */
357 return status; /* cannot or should not try to add continuation line */
358 }
359 lua_pushliteral(L, "\n"); /* add newline... */
360 lua_insert(L, -2); /* ...between the two lines */
361 lua_concat(L, 3); /* join them */
362 }
363}
364
365
366/*

Callers 1

loadlineFunction · 0.70

Calls 7

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

Tested by

no test coverage detected