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

Function pushline

third-party/lua-5.5.0/src/lua.c:567–581  ·  view source on GitHub ↗

** Prompt the user, read a line, and push it into the Lua stack. */

Source from the content-addressed store, hash-verified

565** Prompt the user, read a line, and push it into the Lua stack.
566*/
567static int pushline (lua_State *L, int firstline) {
568 char buffer[LUA_MAXINPUT];
569 size_t l;
570 const char *prmt = get_prompt(L, firstline);
571 char *b = lua_readline(buffer, prmt);
572 lua_pop(L, 1); /* remove prompt */
573 if (b == NULL)
574 return 0; /* no input */
575 l = strlen(b);
576 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
577 b[--l] = '\0'; /* remove it */
578 lua_pushlstring(L, b, l);
579 lua_freeline(b);
580 return 1;
581}
582
583
584/*

Callers 2

multilineFunction · 0.70
loadlineFunction · 0.70

Calls 4

lua_readlineFunction · 0.85
lua_freelineFunction · 0.85
get_promptFunction · 0.70
lua_pushlstringFunction · 0.70

Tested by

no test coverage detected