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

Function pushline

third-party/lua-5.2.4/src/lua.c:260–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258
259
260static int pushline (lua_State *L, int firstline) {
261 char buffer[LUA_MAXINPUT];
262 char *b = buffer;
263 size_t l;
264 const char *prmt = get_prompt(L, firstline);
265 int readstatus = lua_readline(L, b, prmt);
266 lua_pop(L, 1); /* remove result from 'get_prompt' */
267 if (readstatus == 0)
268 return 0; /* no input */
269 l = strlen(b);
270 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
271 b[l-1] = '\0'; /* remove it */
272 if (firstline && b[0] == '=') /* first line starts with `=' ? */
273 lua_pushfstring(L, "return %s", b+1); /* change it to `return' */
274 else
275 lua_pushstring(L, b);
276 lua_freeline(L, b);
277 return 1;
278}
279
280
281static int loadline (lua_State *L) {

Callers 1

loadlineFunction · 0.70

Calls 5

lua_readlineFunction · 0.85
lua_freelineFunction · 0.85
get_promptFunction · 0.70
lua_pushfstringFunction · 0.70
lua_pushstringFunction · 0.70

Tested by

no test coverage detected