MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / pushline

Function pushline

deps/lua/src/lua.c:177–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175
176
177static int pushline (lua_State *L, int firstline) {
178 char buffer[LUA_MAXINPUT];
179 char *b = buffer;
180 size_t l;
181 const char *prmt = get_prompt(L, firstline);
182 if (lua_readline(L, b, prmt) == 0)
183 return 0; /* no input */
184 l = strlen(b);
185 if (l > 0 && b[l-1] == '\n') /* line ends with newline? */
186 b[l-1] = '\0'; /* remove it */
187 if (firstline && b[0] == '=') /* first line starts with `=' ? */
188 lua_pushfstring(L, "return %s", b+1); /* change it to `return' */
189 else
190 lua_pushstring(L, b);
191 lua_freeline(L, b);
192 return 1;
193}
194
195
196static int loadline (lua_State *L) {

Callers 1

loadlineFunction · 0.85

Calls 3

get_promptFunction · 0.85
lua_pushfstringFunction · 0.85
lua_pushstringFunction · 0.85

Tested by

no test coverage detected