| 12160 | |
| 12161 | |
| 12162 | static int io_lines (lua_State *L) { |
| 12163 | if (lua_isnoneornil(L, 1)) { /* no arguments? */ |
| 12164 | /* will iterate over default input */ |
| 12165 | lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); |
| 12166 | return f_lines(L); |
| 12167 | } |
| 12168 | else { |
| 12169 | const char *filename = luaL_checkstring(L, 1); |
| 12170 | FILE **pf = newfile(L); |
| 12171 | *pf = fopen(filename, "r"); |
| 12172 | if (*pf == NULL) |
| 12173 | fileerror(L, 1, filename); |
| 12174 | aux_lines(L, lua_gettop(L), 1); |
| 12175 | return 1; |
| 12176 | } |
| 12177 | } |
| 12178 | |
| 12179 | |
| 12180 | /* |
nothing calls this directly
no test coverage detected