Difference between revisions of "Io.type"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Checks whether '''obj''' is a valid file handle.
 
Checks whether '''obj''' is a valid file handle.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(string) = io.type(obj)
 
(string) = io.type(obj)
 
</source>
 
</source>

Revision as of 14:28, 13 July 2023

Available since: Gideros 2011.6
Class: io

Description

Checks whether obj is a valid file handle. <syntaxhighlight lang="lua"> (string) = io.type(obj) </source>

Returns the string:

  • "file" if obj is an open file handle
  • "closed file" if obj is a closed file handle
  • nil if obj is not a file handle

Parameters

obj: (any) object to test

Return values

Returns (string) string representing the state of the object or nil if not file handler