| 271 | |
| 272 | |
| 273 | static int g_iofile (lua_State *L, const char *f, const char *mode) { |
| 274 | if (!lua_isnoneornil(L, 1)) { |
| 275 | const char *filename = lua_tostring(L, 1); |
| 276 | if (filename) |
| 277 | opencheck(L, filename, mode); |
| 278 | else { |
| 279 | tofile(L); /* check that it's a valid file handle */ |
| 280 | lua_pushvalue(L, 1); |
| 281 | } |
| 282 | lua_setfield(L, LUA_REGISTRYINDEX, f); |
| 283 | } |
| 284 | /* return current value */ |
| 285 | lua_getfield(L, LUA_REGISTRYINDEX, f); |
| 286 | return 1; |
| 287 | } |
| 288 | |
| 289 | |
| 290 | static int io_input (lua_State *L) { |
no test coverage detected