Skip to main content

io_type

Function io_type 

Source
pub fn io_type(state: &mut LuaState) -> Result<usize, LuaError>
Expand description

io.type(x) — return "file", "closed file", or the fail value for a non-handle. C: io_type.

A non-handle pushes the fail value (nil) via the reference’s luaL_pushfail, NOT false; fail is nil on every supported version. An unknown userdata still carrying the FILE* metatable but absent from the LStream side table is treated as closed (it cannot be an open stream).