| 279 | |
| 280 | |
| 281 | static int loadline (lua_State *L) { |
| 282 | int status; |
| 283 | lua_settop(L, 0); |
| 284 | if (!pushline(L, 1)) |
| 285 | return -1; /* no input */ |
| 286 | for (;;) { /* repeat until gets a complete line */ |
| 287 | size_t l; |
| 288 | const char *line = lua_tolstring(L, 1, &l); |
| 289 | status = luaL_loadbuffer(L, line, l, "=stdin"); |
| 290 | if (!incomplete(L, status)) break; /* cannot try to add lines? */ |
| 291 | if (!pushline(L, 0)) /* no more input? */ |
| 292 | return -1; |
| 293 | lua_pushliteral(L, "\n"); /* add a new line... */ |
| 294 | lua_insert(L, -2); /* ...between the two lines */ |
| 295 | lua_concat(L, 3); /* join them */ |
| 296 | } |
| 297 | lua_saveline(L, 1); |
| 298 | lua_remove(L, 1); /* remove line */ |
| 299 | return status; |
| 300 | } |
| 301 | |
| 302 | |
| 303 | static void dotty (lua_State *L) { |
no test coverage detected