| 319 | |
| 320 | |
| 321 | static int g_iofile (lua_State *L, const char *f, const char *mode) { |
| 322 | if (!lua_isnoneornil(L, 1)) { |
| 323 | const char *filename = lua_tostring(L, 1); |
| 324 | if (filename) |
| 325 | opencheck(L, filename, mode); |
| 326 | else { |
| 327 | tofile(L); /* check that it's a valid file handle */ |
| 328 | lua_pushvalue(L, 1); |
| 329 | } |
| 330 | lua_setfield(L, LUA_REGISTRYINDEX, f); |
| 331 | } |
| 332 | /* return current value */ |
| 333 | lua_getfield(L, LUA_REGISTRYINDEX, f); |
| 334 | return 1; |
| 335 | } |
| 336 | |
| 337 | |
| 338 | static int io_input (lua_State *L) { |
no test coverage detected