Difference between revisions of "File.readall"

From OpenEUO
Jump to: navigation, search
(Created page with "== Calling Pattern == Call local f = sl.file(a,b) local r = f.readall() Results r is of type table (or nil upon error). == Example Usage == h = sl.file(getinstalldir()..'...")
 
m (See Also)
Line 42: Line 42:
  
 
* [[EOF]]
 
* [[EOF]]
 
* [[file.readall]]
 
  
 
* [[file.readnext]]
 
* [[file.readnext]]

Revision as of 16:21, 24 November 2010

Calling Pattern

Call

local f = sl.file(a,b)
local r = f.readall()

Results

r is of type table (or nil upon error).

Example Usage

h = sl.file(getinstalldir()..'scripts/testread.dat', 'read')
local val = h.readall()
print(keyvalstr(val))
--> table keys:values = {
    1:38.333412345,
    2:null,
    3:null,
    4:null,
    5:30,
    6:TEST_,
    7:true,
    8:false,
    9:null,
    10:true,
    11:3.141622e-030,
    12:table: 0x011da540,
    }

Description

Readall reads all remaining values stored in the associated file from the current cursor position. If there are no more values (readnext has reached the end of the file), then readall returns EOF. Nils written to a file are stored and returned as null.

Upon Error

Readall returns nil if there is a problem reading the file.

See Also