File.readall

From OpenEUO
Revision as of 16:21, 24 November 2010 by Ximan (Talk | contribs) (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()..'...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

  • file.readall