| 148 | |
| 149 | |
| 150 | static int io_type (lua_State *L) { |
| 151 | LStream *p; |
| 152 | luaL_checkany(L, 1); |
| 153 | p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); |
| 154 | if (p == NULL) |
| 155 | lua_pushnil(L); /* not a file */ |
| 156 | else if (isclosed(p)) |
| 157 | lua_pushliteral(L, "closed file"); |
| 158 | else |
| 159 | lua_pushliteral(L, "file"); |
| 160 | return 1; |
| 161 | } |
| 162 | |
| 163 | |
| 164 | static int f_tostring (lua_State *L) { |
nothing calls this directly
no test coverage detected