Type Function Library io.* Return value String Revision Release 2025.3721 Keywords io, type, file See also io.open()
Checks whether obj is a valid file handle. Returns the string "file" if obj is an open file handle, "closed file" if obj is a closed file handle, or nil if obj is not a file handle.
io.type( obj )
Object. Object to be tested.
local fh print( io.type( fh ) ) --> nil local path = system.pathForFile( "Icon.png", system.ResourceDirectory ) fh = io.open( path ) print( io.type( fh ) ) --> "file" io.close( fh ) print( io.type( fh ) ) --> "closed file"