MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / loadline

Function loadline

lua/lua.c:194–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192
193
194static int loadline (lua_State *L) {
195 int status;
196 lua_settop(L, 0);
197 if (!pushline(L, 1))
198 return -1; /* no input */
199 for (;;) { /* repeat until gets a complete line */
200 status = luaL_loadbuffer(L, lua_tostring(L, 1), lua_strlen(L, 1), "=stdin");
201 if (!incomplete(L, status)) break; /* cannot try to add lines? */
202 if (!pushline(L, 0)) /* no more input? */
203 return -1;
204 lua_pushliteral(L, "\n"); /* add a new line... */
205 lua_insert(L, -2); /* ...between the two lines */
206 lua_concat(L, 3); /* join them */
207 }
208 lua_saveline(L, 1);
209 lua_remove(L, 1); /* remove line */
210 return status;
211}
212
213
214static void dotty (lua_State *L) {

Callers 1

dottyFunction · 0.85

Calls 7

lua_settopFunction · 0.85
pushlineFunction · 0.85
luaL_loadbufferFunction · 0.85
incompleteFunction · 0.85
lua_insertFunction · 0.85
lua_concatFunction · 0.85
lua_removeFunction · 0.85

Tested by

no test coverage detected