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