Difference between revisions of "Io.input"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2011.6<br/> === Description === When called with a file name, it opens the named file (in text mode), and sets its handle as the defau...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 +
'''Class:''' [[io]]<br/>
 +
 
=== Description ===
 
=== Description ===
When called with a file name, it opens the named file (in text mode), and sets its handle as the default input file. When called with a file handle, it simply sets this file handle as the default input file. When called without parameters, it returns the current default input file.  
+
When called with a file name, it opens the named file (in text mode), and sets its handle as the default input file.
  
 +
When called with a file handle, it simply sets this file handle as the default input file.
  
In case of errors this function raises the error, instead of returning an error code.
+
When called without parameters, it returns the current default input file.
<source lang="lua">
+
<syntaxhighlight lang="lua">
(file), = io.input(file,)
+
(file) = io.input(file)
</source>
+
</syntaxhighlight>
'''file:''' (file) file object to use as default input '''optional'''<br/>
+
 
 +
'''In case of errors this function raises the error, instead of returning an error code.'''
 +
 
 +
=== Parameters ===
 +
'''file''': (file) file object to use as default input '''optional'''<br/>
 +
 
 +
=== Return values ===
 
'''Returns''' (file) default input file object<br/>
 
'''Returns''' (file) default input file object<br/>
 +
 +
{{Io}}

Latest revision as of 14:30, 13 July 2023

Available since: Gideros 2011.6
Class: io

Description

When called with a file name, it opens the named file (in text mode), and sets its handle as the default input file.

When called with a file handle, it simply sets this file handle as the default input file.

When called without parameters, it returns the current default input file.

(file) = io.input(file)
In case of errors this function raises the error, instead of returning an error code.

Parameters

file: (file) file object to use as default input optional

Return values

Returns (file) default input file object